No error thrown for a declare class field that have an initializer #12092
Labels
i: bug
i: needs triage
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Bug Report
Current behavior
REPL
No error is thrown from parser. We can find an error message for this from source code(ref:
babel/packages/babel-parser/src/plugins/typescript/index.js
Line 71 in 3628c52
We have a test for this but I think it is wrong because the AST have no
errors
(ref: https://github.com/babel/babel/blob/3628c528676a91cd95bb00d56f799be53185e316/packages/babel-parser/test/fixtures/typescript/class/declare-field-initializer/output.json)Input Code
Expected behavior
It throw a syntax error
"'declare' class fields cannot have an initializer"
.Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
Environment
Possible Solution
Additional context
The text was updated successfully, but these errors were encountered: