Bad esnext emit for static property that references another static property when the class has a decorator #44908
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
π Search Terms
decorator static usedefineforclassfields
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
When targeting
esnext
, theuseDefineForClassFields
option is set by default. Using this combination of options, class C is emitted as follows:The name mangling to
C_1
causes the assignment toY
to fail at runtime.If the decorator is removed, the emit becomes:
which works fine.
If
useDefineForClassFields
is disabled, the property assignment gets moved outside the class definition, where the name mangling is correct.π Expected behavior
Probably just not performing the name mangling when emitting within the class.
I appreciate the decorator functionality is unstable, so please consider this bug report purely informational.
The text was updated successfully, but these errors were encountered: