mike-lischke / antlr4ng

Next Generation TypeScript runtime for ANTLR4
Other
65 stars 11 forks source link

Cannot find name 'errorOptions' #45

Closed jlchmura closed 2 months ago

jlchmura commented 4 months ago

After upgrading to v3.0.3, I'm getting a TS error in ParseTreePatternMatcher.d.ts:

[{
    "resource": "/project/node_modules/antlr4ng/dist/tree/pattern/ParseTreePatternMatcher.d.ts",
    "owner": "typescript",
    "code": "2304",
    "severity": 8,
    "message": "Cannot find name 'ErrorOptions'.",
    "source": "ts",
    "startLineNumber": 87,
    "startColumn": 54,
    "endLineNumber": 87,
    "endColumn": 66
}]
image
mike-lischke commented 4 months ago

That's interesting. The error stems from TS generating the error subclass with error constructor code (which is not necessary, see RecognitionException which also derives from Error without this trouble). I guess the difference comes from the way this error is defined (as static class expression). I'll change that to isolated classes in the next release.

For now just remove this constructor manually from the d.ts file, or set "skipLibCheck" to true in your tsconfig.ts file.

DuShuYuan commented 3 months ago

ErrorOptions in the es2022 lib, take a look at the target property in your tsconfig.json