Closed sudosu98 closed 1 year ago
The way I do this is with a stripped-down tsconfig.json (see tsconfig.json from the grammars-v4 build), and a package.json with the package references (see package.json from the grammars-v4 build).
The instructions for the Typescript target could be improved. Not to single out Typescript, all the target docs are missing an essential part that describes the build environment around the source code. I am no expert on TS, and ChatGPT answers don't usually work. It took me months to devise build solutions for 8 antlr targets for grammars-v4.
The build json files should be part of the documentation for the Typescript target because the build environment is at least as important--if not more so--than the driver source code. A "script" needs to be added to call the Antlr tool using antlr4. And, it should be robust enough to handle Github Dependabot PRs that only work on the Antlr runtime target, since Dependabot does not understand how to upgrade the version used for the Antlr tool.
I noticed that my tsconfig was using 'commonjs' and antlr uses 'ESM' . I changed the module type for my project and it stopped throwing this error or maybe i also added the moduleResolution as 'Node'. It has stopped emitting that error for now.
I noticed that my tsconfig was using 'commonjs' and antlr uses 'ESM' . I changed the module type for my project and it stopped throwing this error or maybe i also added the moduleResolution as 'Node'. It has stopped emitting that error for now.
Proof (again) that the build environment is at least as important--if not more so--than the driver source code.
You should not be using @types/antlr4. ANTLR4 now directly supports typescript.Envoyé de mon iPhoneLe 25 mai 2023 à 12:55, Ken Domino @.***> a écrit :
I noticed that my tsconfig was using 'commonjs' and antlr uses 'ESM' . I changed the module type for my project and it stopped throwing this error or maybe i also added the moduleResolution as 'Node'. It has stopped emitting that error for now.
Proof (again) that the build environment is at least as important--if not more so--than the driver source code.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
When i use the antlr4 npm package the tsconfig.json throws an error
Cannot find type definition file for 'node'.
Although I have included @types/node and @types/antlr4. I am using antlr4 v4.13.0.