inikulin/parse5

Type definitions are not properly generated and typescript compile fails

hoancea opened this issue · 2 comments

If I use the parse5 module in a new npm package and then run a typescript compile, I get errors from the inside the .d.ts files from the parse5 module. The compiler is complaining about the keyword type being included inside the brackets next to the import statements, and the compile succeeds if I manually remove those.

For example, inside index.d.ts in the published version, the first line is:
import { type ParserOptions } from './parser/index.js';
I manually adjusted this to:
import { ParserOptions } from './parser/index.js';
After applying this change in all .d.ts files, I was able to run typescript compile on my project.

I made a small project where I was able to replicate the issue. You should run into the same issue after running npm i && tsc. I am also uploading my output from running tsc.

Versions used:

  • node 18.14.2
  • npm 9.5.0
  • typescript 4.4.3
wooorm commented

Update TypeScript. Your TypeScript is very old.

Duplicate of #878

Thanks for your message