dts-extractor
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

dts-extractor Build Status codecov npm

Extract definition files from local node modules.

Installation & Usage

npm install dts-extractor

Usage:

const dtsExtractor = require('dts-extractor');

(async () => {
    const dts = await dtsExtractor.getDts({
        nodeModulesPath: './node_modules', // path in file system where packages located
        packages: ['xlstream', '@types/moment'], // list of packages 
    });
})();

Usage with Monaco Editor

One of the use-cases for this package is to supply custom typings for Monaco Editor. When typings are extracted as shown in the code snippet above, they can be plugged in to Monaco Editor:

for (const key of Object.keys(dts)) {
    monaco.languages.typescript.typescriptDefaults.addExtraLib(dts[key], key);
}

In result, IntelliSense will be enabled for desired packages: monaco-editor-intellisense

Readme

Keywords

Package Sidebar

Install

npm i dts-extractor

Weekly Downloads

17

Version

1.0.2

License

MIT

Unpacked Size

11.2 kB

Total Files

5

Last publish

Collaborators

  • jansivans