Commit 500a0df
authored
Add useDefineForClassFields flag for Set -> Define property declaration (microsoft#33509)
* Disallow property/accessor overrides
Unless the base property or accessor is abstract
* Disallow uninitialised property overrides
This causes quite a few test breaks. We'll probably want to revert many
of them by switching to the upcoming `declare x: number` syntax.
* Updates from design review + fix ancient bug
1. Don't error when overriding properties from interfaces.
2. Fix error when overriding methods with other things. This had no
tests so I assume that the code was always dead and never worked.
* Need to add a couple of errors and squash one
Will update after checking out other branch for a minute
* Everything works so far
Need to test properties initialised in constructor
* Check for constructor initialisation
* change error wording
* Improve error wording
* Add codefix to add missing 'declare'
* Always emit accessors in .d.ts files
* Allow 'declare' on any uninitialised property decl
* Undo code moves
* Let sleeping dogs lie
* Correctly set NodeFlags.Ambient
And simplify redundant parts of check.
* Remove more unneeded code
* Update baselines
* Update baselines
* Update baselines
* Ignore this-property assignments
* Fix base-in-interface check
* Do not error when base parent is interface
* Fix base interface check
* Add missed baselines
* Fix check
* Fix new errors in services
* Fix new errors in services
* Fix errors in testRunner
* Add flag and turn off errors when on
* Structure of new emit is correct, fake content
It is 'hi'.
* Basically right emit
* Fix one last unitialised property declaration
* Haha no I missed another one
* Fix whitespace back to CRLF
* Minor fix and code cleanup
* New test case
* Fix bug in isInitializedProperty
* Updates from design meeting.
1. Change flag name to useDefineForClassFields (and flip polarity).
2. Forbid ES3 + useDefineForClassFields (since there is no
defineProperty).
3. Forbid overriding an abstract property-with-initializer with an
accessor.
* Update baselines
* Object.defineProperty for methods too
Using code from Ron from his upcoming refactor of the factory functions.
* Update slow baselines
* Improve error message
* Update src/compiler/transformers/utilities.ts
Co-Authored-By: Andrew Branch <andrewbranch@users.noreply.github.com>
* Add test of computed properties
* Remove done TODO1 parent 7d9b22e commit 500a0df
File tree
170 files changed
+6500
-3004
lines changed- src
- compiler
- transformers
- server
- services
- codefixes
- testRunner
- parallel
- unittests/tsserver
- tests
- baselines/reference
- api
- showConfig/Shows tsconfig for single option/useDefineForClassFields
- tsbuild
- amdModulesWithOut
- incremental-declaration-doesnt-change
- incremental-headers-change-without-dts-changes
- initial-build
- outfile-concat
- incremental-declaration-changes
- incremental-declaration-doesnt-change
- incremental-headers-change-without-dts-changes
- initial-build
- cases
- conformance/classes/propertyMemberDeclarations
- fourslash
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
170 files changed
+6500
-3004
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29904 | 29904 | | |
29905 | 29905 | | |
29906 | 29906 | | |
29907 | | - | |
29908 | 29907 | | |
29909 | 29908 | | |
29910 | 29909 | | |
| |||
29938 | 29937 | | |
29939 | 29938 | | |
29940 | 29939 | | |
29941 | | - | |
29942 | 29940 | | |
29943 | 29941 | | |
29944 | 29942 | | |
| |||
29975 | 29973 | | |
29976 | 29974 | | |
29977 | 29975 | | |
29978 | | - | |
29979 | | - | |
29980 | | - | |
29981 | | - | |
29982 | | - | |
29983 | 29976 | | |
29984 | | - | |
29985 | | - | |
| 29977 | + | |
| 29978 | + | |
| 29979 | + | |
| 29980 | + | |
| 29981 | + | |
| 29982 | + | |
| 29983 | + | |
| 29984 | + | |
| 29985 | + | |
| 29986 | + | |
| 29987 | + | |
| 29988 | + | |
| 29989 | + | |
| 29990 | + | |
| 29991 | + | |
| 29992 | + | |
| 29993 | + | |
| 29994 | + | |
| 29995 | + | |
| 29996 | + | |
| 29997 | + | |
| 29998 | + | |
| 29999 | + | |
| 30000 | + | |
| 30001 | + | |
| 30002 | + | |
| 30003 | + | |
| 30004 | + | |
| 30005 | + | |
| 30006 | + | |
| 30007 | + | |
| 30008 | + | |
| 30009 | + | |
| 30010 | + | |
| 30011 | + | |
| 30012 | + | |
| 30013 | + | |
| 30014 | + | |
| 30015 | + | |
| 30016 | + | |
| 30017 | + | |
| 30018 | + | |
| 30019 | + | |
| 30020 | + | |
| 30021 | + | |
| 30022 | + | |
29986 | 30023 | | |
29987 | 30024 | | |
29988 | 30025 | | |
| |||
30044 | 30081 | | |
30045 | 30082 | | |
30046 | 30083 | | |
| 30084 | + | |
| 30085 | + | |
| 30086 | + | |
30047 | 30087 | | |
30048 | 30088 | | |
30049 | 30089 | | |
| |||
32970 | 33010 | | |
32971 | 33011 | | |
32972 | 33012 | | |
32973 | | - | |
| 33013 | + | |
32974 | 33014 | | |
32975 | 33015 | | |
32976 | 33016 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
873 | 873 | | |
874 | 874 | | |
875 | 875 | | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
876 | 883 | | |
877 | 884 | | |
878 | 885 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2233 | 2233 | | |
2234 | 2234 | | |
2235 | 2235 | | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
2236 | 2249 | | |
2237 | 2250 | | |
2238 | 2251 | | |
| |||
3112 | 3125 | | |
3113 | 3126 | | |
3114 | 3127 | | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
3115 | 3132 | | |
3116 | 3133 | | |
3117 | 3134 | | |
| |||
3966 | 3983 | | |
3967 | 3984 | | |
3968 | 3985 | | |
| 3986 | + | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
3969 | 3990 | | |
3970 | 3991 | | |
3971 | 3992 | | |
| |||
4043 | 4064 | | |
4044 | 4065 | | |
4045 | 4066 | | |
| 4067 | + | |
| 4068 | + | |
| 4069 | + | |
| 4070 | + | |
4046 | 4071 | | |
4047 | 4072 | | |
4048 | 4073 | | |
| |||
4052 | 4077 | | |
4053 | 4078 | | |
4054 | 4079 | | |
4055 | | - | |
4056 | | - | |
4057 | | - | |
4058 | | - | |
| 4080 | + | |
4059 | 4081 | | |
4060 | 4082 | | |
4061 | 4083 | | |
| |||
5180 | 5202 | | |
5181 | 5203 | | |
5182 | 5204 | | |
| 5205 | + | |
| 5206 | + | |
| 5207 | + | |
| 5208 | + | |
| 5209 | + | |
| 5210 | + | |
| 5211 | + | |
| 5212 | + | |
5183 | 5213 | | |
5184 | 5214 | | |
5185 | 5215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
487 | 528 | | |
488 | 529 | | |
489 | 530 | | |
| |||
3146 | 3187 | | |
3147 | 3188 | | |
3148 | 3189 | | |
3149 | | - | |
3150 | | - | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
3151 | 3195 | | |
3152 | 3196 | | |
3153 | 3197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5995 | 5995 | | |
5996 | 5996 | | |
5997 | 5997 | | |
5998 | | - | |
5999 | | - | |
| 5998 | + | |
| 5999 | + | |
| 6000 | + | |
| 6001 | + | |
| 6002 | + | |
| 6003 | + | |
| 6004 | + | |
| 6005 | + | |
| 6006 | + | |
| 6007 | + | |
6000 | 6008 | | |
6001 | 6009 | | |
6002 | 6010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3073 | 3073 | | |
3074 | 3074 | | |
3075 | 3075 | | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
3076 | 3080 | | |
3077 | 3081 | | |
3078 | 3082 | | |
| |||
0 commit comments