-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed as not planned
Closed as not planned
Copy link
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
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
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created