"useDefineForClassFields" breaks ambient public fields #34972
Labels
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Fixed
A PR has been merged for this issue
High Priority
Milestone
TypeScript Version: 3.8.0-dev.20191105
Search Terms: declare ambient public class field useDefineForClassFields
Code
Expected behavior:
Ambient class fields should not be emitted.
Actual behavior:
The class field is included in the emitted JS code.
When
"useDefineForClassFields"
is disabled, thedeclare
keyword works correctly and omits the field. When"useDefineForClassFields"
is enabled, thedeclare
keyword fails and has no effect on emit. This means the field gets defined on the instance, even though the programmer wanted it to be omitted.Playground Link:
Related Issues: #34942
The text was updated successfully, but these errors were encountered: