Resolve compiler errors that appear due to useDefineForClassFields #241544
+2,322
−1,435
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes go a ways towards addressing #186726
These changes DO NOT include setting
useDefineForClassFields
totrue
so backsliding is still possible.These changes were done by hand over a period of about five focused hours. There were 500 errors when I started.
The process I used was:
useDefineForClassFields
in the base tsconfig file (NOT IN THIS PR)npm run watch
waitForState
andrecomputeInitiallyAndOnChange
and inline any impactedderived
fieldsTo truly enable
useDefineForClassFields
, more changes will more than likely need to be made. For now, I was interested in tackling the compilation errors.All tests pass with these changes.
If the VSCode team would like to take over this PR, that's fine.
The motivation for making these changes is that, at Google, we build this codebase internally. We are going to enable the compilation errors related to
useDefineForClassFields
in our internal typescript compiler settings (without actually turning on those transpilation changes, similar to microsoft/TypeScript#59623). So we would much prefer to fix these issues in your codebase rather than maintain a huge 200 file patch :P