We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://www.typescriptlang.org/play/?useDefineForClassFields=true&target=7#code/PTAEAEBcEMCcHMCmkBcpEGcBMAGXAoECAVw0QBFEAzASwDtEAxAe1gGEAbaDDRmxDgBMMaSLGKJ8AYy49QAFQCeAB0QBlKbBrLIABTjQAtskSxdsZqtiR+GUAG98oZ6CJQMAWhrw6rSS9AqZmZQAF5QSAALGgwAOgAjOABuJxcpZjoMMWIpSFYACmVieI4aKVBE2DRoOkUASgdUgOd0zOYORFiOZnh8gCJaOmgODkU+gBoI6Lig5jqUgIBffGX8BgB3BRV1TW09A2NIU3NLUxtMfoA3YYk++aA
// @target: es2020 // @useDefineForClassFields: true class TypeScriptParameterProperties { // @ts-ignore foo = this.bar; constructor(public bar: any) { console.log("finally", this.foo); } } new TypeScriptParameterProperties("value");
// @target: esnext // @useDefineForClassFields: true class TypeScriptParameterProperties { // @ts-ignore foo = this.bar; constructor(public bar: any) { console.log("finally", this.foo); } } new TypeScriptParameterProperties("value");
Different compilation options will output different values.
es2020: "finally", "value" esnext: "finally", undefined
They should output the same value.
useDefineForClassFields: false
The text was updated successfully, but these errors were encountered:
Here is another example, which does not use ts-ignore and ts does not report any errors.
// @target: es2020 // @useDefineForClassFields: true class TypeScriptParameterProperties { foo = console.log("foo"); constructor(public bar: any = console.log("bar")) { console.log("finally"); } } new TypeScriptParameterProperties();
Playground
// @target: esnext // @useDefineForClassFields: true class TypeScriptParameterProperties { foo = console.log("foo"); constructor(public bar: any = console.log("bar")) { console.log("finally"); } } new TypeScriptParameterProperties();
The order in which they print out foo and bar is different.
foo
bar
Sorry, something went wrong.
Duplicate of #45995, #55132.
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.
No branches or pull requests
🔎 Search Terms
📌 Related issues
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?useDefineForClassFields=true&target=7#code/PTAEAEBcEMCcHMCmkBcpEGcBMAGXAoECAVw0QBFEAzASwDtEAxAe1gGEAbaDDRmxDgBMMaSLGKJ8AYy49QAFQCeAB0QBlKbBrLIABTjQAtskSxdsZqtiR+GUAG98oZ6CJQMAWhrw6rSS9AqZmZQAF5QSAALGgwAOgAjOABuJxcpZjoMMWIpSFYACmVieI4aKVBE2DRoOkUASgdUgOd0zOYORFiOZnh8gCJaOmgODkU+gBoI6Lig5jqUgIBffGX8BgB3BRV1TW09A2NIU3NLUxtMfoA3YYk++aA
💻 Code
🙁 Actual behavior
Different compilation options will output different values.
es2020: "finally", "value"
esnext: "finally", undefined
🙂 Expected behavior
They should output the same value.
Additional information about the issue
useDefineForClassFields: false
swc-project/swc#7055 (comment)The text was updated successfully, but these errors were encountered: