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
As explained in #2548, the following code is not correct when useDefineForClassFields: false, which is the default for targets before ES2021.
useDefineForClassFields: false
const x = 1 class C { p = x constructor(x: string) { } }
However, when useDefineForClassFields: true, there shouldn't be an error here.
useDefineForClassFields: true
Expected: No error 2301 on private p = x, and p: number Actual: Error on private p = x and p: any
private p = x
p: number
p: any
The text was updated successfully, but these errors were encountered:
This is broken because the outer x gets shadowed by the ctor parameter, right? But that means it’s also broken for downleveled useDefineForClassFields too…
x
useDefineForClassFields
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
As explained in #2548, the following code is not correct when
useDefineForClassFields: false, which is the default for targets before ES2021.However, when
useDefineForClassFields: true, there shouldn't be an error here.Expected: No error 2301 on
private p = x, andp: numberActual: Error on
private p = xandp: anyThe text was updated successfully, but these errors were encountered: