tunnelvisionlabs / antlr4ts

Optimized TypeScript target for ANTLR 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TS complains about error TS2611: <propertyName> is defined as a property in class <classNameA>, but is overridden here in <classNameB> as an accessor.

MartinPavlik opened this issue · comments

Hi,

I'm facing an issue that tsc complains about following errors in generated files. Do you have any idea what is wrong, please?

$ tsc --project tsconfig.json
QueryLangLexer.ts:97:13 - error TS2611: 'serializedATN' is defined as a property in class 'Lexer', but is overridden here in 'QueryLangLexer' as an accessor.

97  public get serializedATN(): string { return QueryLangLexer._serializedATN; }
               ~~~~~~~~~~~~~

QueryLangParser.ts:112:13 - error TS2611: 'serializedATN' is defined as a property in class 'Parser', but is overridden here in 'QueryLangParser' as an accessor.

112  public get serializedATN(): string { return QueryLangParser._serializedATN; }
                ~~~~~~~~~~~~~

QueryLangParser.ts:975:13 - error TS2611: 'ruleIndex' is defined as a property in class 'ParserRuleContext', but is overridden here in 'WholeQueryContext' as an accessor.

975  public get ruleIndex(): number { return QueryLangParser.RULE_wholeQuery; }
                ~~~~~~~~~

QueryLangParser.ts:1028:13 - error TS2611: 'ruleIndex' is defined as a property in class 'ParserRuleContext', but is overridden here in 'QueryContext' as an accessor.

1028  public get ruleIndex(): number { return QueryLangParser.RULE_query; }
                 ~~~~~~~~~

QueryLangParser.ts:1064:13 - error TS2611: 'ruleIndex' is defined as a property in class 'ParserRuleContext', but is overridden here in 'CmcQueryContext' as an accessor.

1064  public get ruleIndex(): number { return QueryLangParser.RULE_cmcQuery; }
                 ~~~~~~~~~

...

My package.json:

{
  "name": "antlr4-example",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "antlr": "antlr4ts -visitor QueryLang.g4",
    "compile": "tsc --project tsconfig.json",
    "start": "node dist/index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "antlr4ts": "^0.5.0-alpha.3"
  },
  "devDependencies": {
    "@types/node": "^14.11.2",
    "antlr4ts-cli": "^0.5.0-alpha.3",
    "typescript": "^4.0.3"
  }
}

My tsconfig.json:

{
  "compilerOptions": {
    "outDir": "dist",
    "sourceMap": true,
    "inlineSources": true,
    "module": "commonjs",
    "target": "es2015",
    "lib": [
      "es6"
    ],
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "experimentalDecorators": true,
    "declaration": true,
    "preserveConstEnums": true,
    "typeRoots": [
      "./node_modules/@types"
    ]
  },
  "exclude": [
    "node_modules",
    "dist"
  ],
}

Node version:

v10.16.3

Thanks for any help 🍻

Ah lol, duplicate of #485