Commit 5c2eeb2
authored
Destructuring declaration prefers type annotation type (microsoft#25282)
* Destructuring declaration prefers type annotation type
Previously, getTypeForBindingElement would always union the declarations type and
the type of the default initializer. Now, if the declaration has a type
annotation, it does not union with the initializer type. The type
annotation's type is the one used.
* Small cleanup in parentDeclarationHasTypeAnnotation
* Refactoring based on PR comments
* Combine getCombined*Flags into a single helper function
Retain the individual functions since they are used a lot.
* Remove unneeded temp1 parent 950593b commit 5c2eeb2Copy full SHA for 5c2eeb2
17 files changed
+328-55Lines changed: 328 additions & 55 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- src
- compiler
- services
- tests
- baselines/reference
- api
- cases
- conformance/es6/destructuring
- user/TypeScript-Node-Starter
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+3-3Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4161 | 4161 | |
4162 | 4162 | |
4163 | 4163 | |
4164 | | - |
| 4164 | + |
4165 | 4165 | |
4166 | 4166 | |
4167 | 4167 | |
| ||
4525 | 4525 | |
4526 | 4526 | |
4527 | 4527 | |
4528 | | - |
| 4528 | + |
4529 | 4529 | |
4530 | 4530 | |
4531 | 4531 | |
| ||
22096 | 22096 | |
22097 | 22097 | |
22098 | 22098 | |
22099 | | - |
| 22099 | + |
22100 | 22100 | |
22101 | 22101 | |
22102 | 22102 | |
|
Collapse file
+18-31Lines changed: 18 additions & 31 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
903 | 903 | |
904 | 904 | |
905 | 905 | |
906 | | - |
| 906 | + |
907 | 907 | |
908 | 908 | |
909 | 909 | |
| ||
4605 | 4605 | |
4606 | 4606 | |
4607 | 4607 | |
4608 | | - |
4609 | | - |
4610 | | - |
| 4608 | + |
| 4609 | + |
| 4610 | + |
| 4611 | + |
4611 | 4612 | |
4612 | | - |
4613 | | - |
| 4613 | + |
4614 | 4614 | |
4615 | 4615 | |
4616 | | - |
4617 | | - |
4618 | | - |
| 4616 | + |
| 4617 | + |
| 4618 | + |
| 4619 | + |
| 4620 | + |
4619 | 4621 | |
4620 | 4622 | |
4621 | 4623 | |
4622 | | - |
4623 | 4624 | |
4624 | | - |
| 4625 | + |
4625 | 4626 | |
4626 | 4627 | |
4627 | | - |
4628 | 4628 | |
4629 | | - |
| 4629 | + |
4630 | 4630 | |
4631 | | - |
4632 | 4631 | |
4633 | 4632 | |
4634 | 4633 | |
| 4634 | + |
| 4635 | + |
| 4636 | + |
| 4637 | + |
4635 | 4638 | |
4636 | 4639 | |
4637 | 4640 | |
| ||
4640 | 4643 | |
4641 | 4644 | |
4642 | 4645 | |
4643 | | - |
4644 | | - |
4645 | | - |
4646 | | - |
4647 | | - |
4648 | | - |
4649 | | - |
4650 | | - |
4651 | | - |
4652 | | - |
4653 | | - |
4654 | | - |
4655 | | - |
4656 | | - |
4657 | | - |
4658 | | - |
4659 | | - |
| 4646 | + |
4660 | 4647 | |
4661 | 4648 | |
4662 | 4649 | |
|
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1044 | 1044 | |
1045 | 1045 | |
1046 | 1046 | |
1047 | | - |
| 1047 | + |
1048 | 1048 | |
1049 | 1049 | |
1050 | 1050 | |
|
Collapse file
tests/baselines/reference/api/tsserverlibrary.d.ts
Copy file name to clipboardExpand all lines: tests/baselines/reference/api/tsserverlibrary.d.ts+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6677 | 6677 | |
6678 | 6678 | |
6679 | 6679 | |
6680 | | - |
| 6680 | + |
| 6681 | + |
6681 | 6682 | |
6682 | 6683 | |
6683 | 6684 | |
|
Collapse file
tests/baselines/reference/api/typescript.d.ts
Copy file name to clipboardExpand all lines: tests/baselines/reference/api/typescript.d.ts+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3175 | 3175 | |
3176 | 3176 | |
3177 | 3177 | |
3178 | | - |
| 3178 | + |
| 3179 | + |
3179 | 3180 | |
3180 | 3181 | |
3181 | 3182 | |
|
Collapse file
tests/baselines/reference/contextuallyTypedBindingInitializerNegative.errors.txt
Copy file name to clipboard+67Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
Collapse file
tests/baselines/reference/contextuallyTypedBindingInitializerNegative.types
Copy file name to clipboardExpand all lines: tests/baselines/reference/contextuallyTypedBindingInitializerNegative.types+7-7Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | | - |
| 12 | + |
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | 19 | |
20 | | - |
| 20 | + |
21 | 21 | |
22 | 22 | |
23 | 23 | |
| ||
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | | - |
| 29 | + |
30 | 30 | |
31 | 31 | |
32 | 32 | |
| ||
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | | - |
| 45 | + |
46 | 46 | |
47 | 47 | |
48 | 48 | |
| ||
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | | - |
| 62 | + |
63 | 63 | |
64 | 64 | |
65 | 65 | |
| ||
80 | 80 | |
81 | 81 | |
82 | 82 | |
83 | | - |
| 83 | + |
84 | 84 | |
85 | 85 | |
86 | 86 | |
| ||
94 | 94 | |
95 | 95 | |
96 | 96 | |
97 | | - |
| 97 | + |
98 | 98 | |
99 | 99 | |
100 | 100 | |
Collapse file
tests/baselines/reference/destructuringParameterDeclaration8.errors.txt
Copy file name to clipboard+42Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
Collapse file
tests/baselines/reference/destructuringParameterDeclaration8.js
Copy file name to clipboard+33Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
0 commit comments