antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.22k stars 3.29k forks source link

[TypeScript]: The module “antlr4” or the associated type declarations were not found.ts(2307) #4662

Closed MarkusFaatz closed 3 months ago

MarkusFaatz commented 3 months ago

After installing the package, TypeScript could not find the type definitions.

I only could get it to work by manually adding the antlr4's src directory to my tsconfig.json file like so

{
  "compilerOptions": {
    ...,
    "typeRoots": [
      "./node_modules/antlr4/src"
    ],
    ...
 }
}

I am not an expert in this but I guess that something is not working as expected with the types sections within the package.json of the antlr npm package.

ericvergnaud commented 3 months ago

Presumably fixed by #4644

MarkusFaatz commented 3 months ago

Yes! I could verify the fix by applying the changes manually to the package.json within the _nodemodules/antlr4 directory. Thanks a lot! 👍🏽