I see the following Typescript error when importing chevrotain in ESM:
error TS7016: Could not find a declaration file for module 'chevrotain'. '.../chevrotain-typescript-issue/node_modules/chevrotain/lib/src/api.js' implicitly has an 'any' type.
There are types at '.../chevrotain-typescript-issue/node_modules/chevrotain/chevrotain.d.ts', but this result could not be resolved when respecting package.json "exports". The 'chevrotain' library may need to update its package.json or typings.
When googling the error, I found this tool https://arethetypeswrong.github.io (from https://github.com/microsoft/TypeScript/issues/52363) that could show more details:
In my local, if I go to node_modules/chevrotain/package.json and change the exports section to:
Hi,
I see the following Typescript error when importing
chevrotain
in ESM:Here's a minimal reproduction repo: https://github.com/baodart/chevrotain-typescript-issue
When googling the error, I found this tool https://arethetypeswrong.github.io (from
https://github.com/microsoft/TypeScript/issues/52363
) that could show more details:In my local, if I go to
node_modules/chevrotain/package.json
and change theexports
section to:Then my local shows no more error (not sure if it is the right fix 😂).