Closed as not planned
Description
🔎 Search Terms
- class
- constructor parameter
- useDefineForClassFields
- initialization
📌 Related issues
- Inconsistent parameter properties initialization order depending on the target syntax with useDefineForClassFields #45995
- Incorrect emit for parameter properties when using standard class fields #55132
🕗 Version & Regression Information
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
💻 Code
// @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");
🙁 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment