New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Babel parser typescript should throw when accessors do not agree in visibility #13125
Comments
Hey @JLHwung! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
Should this really be considered a syntax error, not a semantic one? |
I think if an error can be thrown in compile time (in contrast runtime is running the type checking), then any early error belongs to syntax error. |
Should we check for duplicate methods too? |
Duplicate public methods are allowed in ECMAScript: class C { foo() {}; foo(v) {} } The TS error falls to diagnostic errors IMHO. |
I think we can check it here by looking for some other methods in babel/packages/babel-parser/src/plugins/typescript/index.js Lines 2462 to 2488 in bdbd07d
However it is almost useless if a user can specify multiple getters/setters with same name: class C {
public get foo() {}
private get foo() {}
public set foo(v) {}
} |
Bug Report
Current behavior
Parsed successfully.
Input Code
Expected behavior
Babel parser should throw when accessors do not agree in visibility
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
REPL
Possible Solution
Additional context
Found this issue when reviewing #13089.
The text was updated successfully, but these errors were encountered: