-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property initializers output for non-initialized types #45076
Comments
Relevant: the It seems that starting in TypeScript 4.3, this compiler option is now enabled by default if your target is ESNext. (See #42663 for implementation). This is likely what you are running into here. But, according to this comment in #34787, this change is not documented anywhere in the release notes for TypeScript 4.3. So possibly this bug report is a request that the TypeScript 4.3 release notes should mention this as a breaking change? (And maybe it belongs on the TypeScript-website issue list instead of here?) |
Ah! That's the culprit. Thanks.
That seems reasonable. I see several people commented that they ran into it as well, and it took some time to track down. It sidelined a good chunk of my day, also, when I bumped TS versions. Was a little tricky to figure out what was happening. Adding to the documentation is probably a good idea. Looks like the issue was flagged as |
To be fair, "ESNext" is not really a stable target and is breaking by definition. :-) |
For what it’s worth: The change definitely should be documented, though. |
Bug Report
This is technically not a bug, given ES Spec, however, I'm filing an issue in case an consideration needs to be made on how to handle with regard to documentation, etc, and/or to provide a solution for people facing the same.
Issue Summary
This results in any properties specified in the inherited class that are assigned during the base class constructor to be overwritten, even if they do not have initializer values specified in the inherited class.
The behaviour which causes the error can be seen below:
Output is:
Here is a simplified version of how this affected me
The above produces:
🔎 Search Terms
🕗 Version & Regression Information
TS 4.3.5
Solution
For those facing this issue, simply change property declarations to ambient.
ie:
The text was updated successfully, but these errors were encountered: