lezer-parser/lezer

Types are broken when used with node16/nodenext

berekuk opened this issue · 2 comments

lezer-generator generates a file with import {LRParser, LocalTokenGroup} from "@lezer/lr".

That import is not working when used with Typescript in moduleResolution: "node16" mode; index.d.ts in @lezer/lr tries to import types from other files, e.g. ./parse and ./token, but these imports are not resolved properly.

I can't switch to moduleResolution: "bundler" as recommended here, because I'm working on a public npm package and it might cause compatibility issues for users.

I think it should be fixed by emitting definitions with full "./parse.js" and "./token.js" and so on, both in this package and in @lezer/common, but I'm not sure if it will cause problems for other users with other configurations. Patching this manually in ./node_modules fixes this problem in my case.

The problem is relatively critical for me: it blocks me from disabling "noImplicitAny": false in my project.

I think @lezer/lr 1.3.10 should fix this

Thanks, I can confirm that the fix worked.