-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add useDefineForClassFields flag for Set -> Define property declaration #33509
Merged
Merged
Changes from 52 commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
f76e01f
Disallow property/accessor overrides
sandersn ac96739
Disallow uninitialised property overrides
sandersn c26785e
Merge branch 'master' into disallow-property-accessor-override
sandersn c4f334a
Updates from design review + fix ancient bug
sandersn 70a15bd
Need to add a couple of errors and squash one
sandersn feb0fb6
Everything works so far
sandersn 8686242
Check for constructor initialisation
sandersn 2916c29
change error wording
sandersn 2e5f57c
Improve error wording
sandersn f11f2be
Add codefix to add missing 'declare'
sandersn 526ceb7
Merge branch 'master' into disallow-property-accessor-override
sandersn a8f4610
Merge branch 'master' into disallow-uninitialised-property-override
sandersn 2238b66
Always emit accessors in .d.ts files
sandersn fcf0ff1
Allow 'declare' on any uninitialised property decl
sandersn 810f923
Undo code moves
sandersn 6408d7a
Let sleeping dogs lie
sandersn 5ee3271
Correctly set NodeFlags.Ambient
sandersn e0ddced
Remove more unneeded code
sandersn 610a62d
Merge branch 'disallow-property-accessor-override' into add-property-…
sandersn e7ba1ae
Merge branch 'disallow-uninitialised-property-override' into add-prop…
sandersn 6c94395
Merge branch 'always-emit-accessors-in-dts' into add-property-define-…
sandersn 6a066b9
Update baselines
sandersn 0548220
Merge branch 'disallow-uninitialised-property-override' into sandersn…
sandersn 7f69be7
Update baselines
sandersn 8f42126
Merge branch 'always-emit-accessors-in-dts' into sandersn/add-propert…
sandersn d46a0db
Update baselines
sandersn 58e1746
Ignore this-property assignments
sandersn 9b358b1
Merge branch 'disallow-property-accessor-override' into sandersn/add-…
sandersn 832d51f
Fix base-in-interface check
sandersn 9c6aa17
Merge branch 'disallow-property-accessor-override' into sandersn/add-…
sandersn a645ca9
Do not error when base parent is interface
sandersn 030c768
Fix base interface check
sandersn 003d041
Add missed baselines
sandersn 6ec445f
Fix check
sandersn c283574
Fix new errors in services
sandersn 1c5f699
Fix new errors in services
sandersn 2403116
Merge branch 'disallow-property-accessor-override' into sandersn/add-…
sandersn b45b5ba
Merge branch 'disallow-uninitialised-property-override' into sandersn…
sandersn 8d99856
Fix errors in testRunner
sandersn f400822
Add flag and turn off errors when on
sandersn 1f68bea
Structure of new emit is correct, fake content
sandersn 6c35ac2
Basically right emit
sandersn fbeaf01
Fix one last unitialised property declaration
sandersn a5b1d8f
Haha no I missed another one
sandersn 32a73b3
Fix whitespace back to CRLF
sandersn 5028bfa
Minor fix and code cleanup
sandersn 8053e05
New test case
sandersn 7fdb423
Fix bug in isInitializedProperty
sandersn 18c622c
Updates from design meeting.
sandersn 8268f9a
Update baselines
sandersn 5eeb2b0
Object.defineProperty for methods too
sandersn 5ea2bc1
Update slow baselines
sandersn 088daa8
Improve error message
sandersn e600ebe
Update src/compiler/transformers/utilities.ts
sandersn 6e3bf5c
Add test of computed properties
sandersn ba876cf
Remove done TODO
sandersn 6a1e24c
Merge branch 'master' into sandersn/add-property-define-flag
sandersn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: if the base property’s type is identical to the derived property’s type, better advice might be to delete the property declaration altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know; I saw enough of this that I think there must be some kind of intent behind it. I don't think people truly trust inheritance. I know I don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although adding an initializer isn't a propos in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right—adding an an initializer changes the semantics, so assuming you don’t want that, the guidance is to add
declare
, which is utterly meaningless, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not saying that “delete this” must be the only option listed in the error message; maybe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
(the base declaration might be the redundant one, so I changed "this redundant" to "the redundant".)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I like that it clarifies that adding an initializer and adding a declare modifier essentially have opposite semantics. The original error message kind of sounds like they’ll have the same effect.