Open
Description
Bug Report
🔎 Search Terms
properties initialization esnext order initialization fields useDefineForClassFields
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about classes
Ref: babel/babel#13779
⏯ Playground Link
Playground link with relevant code (ES2021 target)
Playground link with relevant code (ESNext target)
💻 Code
new class Dashboard {
name = console.log(this.amount);
constructor(public amount: number) {
}
}(1);
🙁 Actual behavior
When targeting ES2021 this.amount
is initialized first; when targeting ESNext this.name
is initialized first.
🙂 Expected behavior
They should be consistent.