npm-dts: Doesn't seem to work with JavaScript source files

Tried running this with a small test module and I get this:

> npm-dts generate -r . -e lib/index.js -L verbose

[npm-dts] [info] :  _________________________________________ 
[npm-dts] [info] : |                                         |
[npm-dts] [info] : |                                         |
[npm-dts] [info] : |          npm-dts v1.1.10                |
[npm-dts] [info] : |          by Vytenis Urbonavičius        |
[npm-dts] [info] : |                                         |
[npm-dts] [info] : |_________________________________________|
[npm-dts] [info] :                                            
[npm-dts] [info] : Generating declarations for "/Users/{someone}/Workspace/sandbox/docs"...
[npm-dts] [verbose] : Locating OS Temporary Directory...
[npm-dts] [verbose] : OS Temporary Directory was located!
[npm-dts] [verbose] : Will now reset "tmp" directory...
[npm-dts] [verbose] : Cleaning up "tmp" directory...
[npm-dts] [verbose] : "tmp" directory was cleaned!
[npm-dts] [verbose] : Preparing "tmp" directory...
[npm-dts] [verbose] : "tmp" directory was prepared!
[npm-dts] [verbose] : Generating per-file typings using TSC...
[npm-dts] [error] : Generation of index.d.ts has failed!
[npm-dts] [verbose] : Cleaning up "tmp" directory...
[npm-dts] [verbose] : "tmp" directory was cleaned!
[npm-dts] [verbose] : Deleting OS Temporary Directory...
[npm-dts] [verbose] : OS Temporary Directory was deleted!
[npm-dts] [error] : Generation failed!

My tsconfig.json is:

{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "strict": true,
    "strictNullChecks": true,
    "outDir": "build"
  },
  "include": [
    "lib"
  ]
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I have just released npm-dts 1.2.0.

It supports “-f” flag which would attempt generation despite errors. By using “-f” one needs to understand that output may not be 100% valid.

Let me know if this helps.

Good point and yes - that is doable!

You are right - npm-dts currently halts as soon as it encounters error output from TSC. I can introduce “force” mode which would continue for as long as there is d.ts produced despite any errors. Should be an easy win.

Can you paste errors that you get here by any chance?