-
Notifications
You must be signed in to change notification settings - Fork 8
Description
This is an absolutely fantastic library! 👏🏻
I was just wondering whether you could create a typescript definition file:
index.d.ts
I want to use this with my node project, which is written in typescript, but when I try and run it, I get:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'indent'
I am importing it like:
import indent from 'indent.js';
I have also tried:
const indent = require('indent');
And then:
indentCode(code, options) {
var indented = indent.js(code, options);
return indented;
}
I think the error is being thrown, because it cannot find a type definition?
UPDATE: 15.02.2024
I have attached the index.d.ts file to this comment.
If you want to add more type definitions, please feel free to do so. I just wanted to provide a quick, easy solution, to allow this library to work with typescript projects.
Add this file to your the following folder:
/lib
And then add this to the top of your js/ts file:
const indent = require(‘indent.js’);