You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Index signatures for symbols and template literal strings (#44512)
* Switch index signature storage to 'indexInfos: IndexInfo[]' property
* Accept new baselines
* Remove another usage of IndexKind enum
* Update getIndexedAccessType and resolveMappedTypeMembers
* Accept new baselines
* Update grammar checking for index signatures
* Accept new baselines
* Consider all index signatures in mapped types and union types
* Accept new baselines
* Update getIndexType
* Accept new baselines
* Intersect multiple applicable index signatures
* Use getApplicableIndexInfo instead of hardwired string/number handling
* Update index signature relationship checking
* Report type for which index signature is missing
* Report type for which index signature is missing
* Accept new baselines
* Make 'number' index signatures consistently apply to numeric strings
* Accept new baselines
* Update fourslash test
* Revise index constraint checking
* Accept new baselines
* Update error messages
* Accept new baselines
* Update type inference from index signatures
* Update isKnownProperty
* Update contextual typing based on index signatures
* Accept new baselines
* Support union types in index signature declarations
* Accept new baselines
* Check duplicate index signatures / remove redundant template literals from unions with string
* Accept new baselines
* Include key type in diagnostic / check symbol-named properties
* Accept new baselines
* Minor fix
* Add tests
* Accept new baselines
* Add optimized findApplicableIndexInfoForName
* Accept new baselines
* Another place we don't need to obtain literal type for property name
* Accept new baselines
* Don't create literal types that are going to be discarded
* Individual maps for string, number, bigint, and enum literal types
* Remove ineffective optimizations
* Accept new baselines
* Permit intersections as key types in index signatures
* Index expression in element access is template literal context
* Add tests
* Accept new baselines
* Symbol index signatures from object literals with computed symbol properties
* Accept new baselines
* Add more tests
* Accept new baselines
* Implement Go To Definition for all applicable index signatures
* Add fourslash test
* Accept new API baselines
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json
+14-22Lines changed: 14 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -75,10 +75,6 @@
75
75
"category": "Error",
76
76
"code": 1022
77
77
},
78
-
"An index signature parameter type must be either 'string' or 'number'.": {
79
-
"category": "Error",
80
-
"code": 1023
81
-
},
82
78
"'readonly' modifier can only appear on a property declaration or index signature.": {
83
79
"category": "Error",
84
80
"code": 1024
@@ -891,6 +887,10 @@
891
887
"category": "Error",
892
888
"code": 1267
893
889
},
890
+
"An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type.": {
891
+
"category": "Error",
892
+
"code": 1268
893
+
},
894
894
895
895
"'with' statements are not allowed in an async function block.": {
896
896
"category": "Error",
@@ -996,11 +996,7 @@
996
996
"category": "Error",
997
997
"code": 1335
998
998
},
999
-
"An index signature parameter type cannot be a type alias. Consider writing '[{0}: {1}]: {2}' instead.": {
1000
-
"category": "Error",
1001
-
"code": 1336
1002
-
},
1003
-
"An index signature parameter type cannot be a union type. Consider using a mapped object type instead.": {
999
+
"An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.": {
1004
1000
"category": "Error",
1005
1001
"code": 1337
1006
1002
},
@@ -1518,11 +1514,11 @@
1518
1514
"category": "Error",
1519
1515
"code": 2328
1520
1516
},
1521
-
"Index signature is missing in type '{0}'.": {
1517
+
"Index signature for type '{0}' is missing in type '{1}'.": {
1522
1518
"category": "Error",
1523
1519
"code": 2329
1524
1520
},
1525
-
"Index signatures are incompatible.": {
1521
+
"'{0}' and '{1}' index signatures are incompatible.": {
1526
1522
"category": "Error",
1527
1523
"code": 2330
1528
1524
},
@@ -1698,14 +1694,10 @@
1698
1694
"category": "Error",
1699
1695
"code": 2373
1700
1696
},
1701
-
"Duplicate string index signature.": {
1697
+
"Duplicate index signature for type '{0}'.": {
1702
1698
"category": "Error",
1703
1699
"code": 2374
1704
1700
},
1705
-
"Duplicate number index signature.": {
1706
-
"category": "Error",
1707
-
"code": 2375
1708
-
},
1709
1701
"A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.": {
1710
1702
"category": "Error",
1711
1703
"code": 2376
@@ -1842,15 +1834,11 @@
1842
1834
"category": "Error",
1843
1835
"code": 2410
1844
1836
},
1845
-
"Property '{0}' of type '{1}' is not assignable to string index type '{2}'.": {
1837
+
"Property '{0}' of type '{1}' is not assignable to '{2}' index type '{3}'.": {
1846
1838
"category": "Error",
1847
1839
"code": 2411
1848
1840
},
1849
-
"Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'.": {
1850
-
"category": "Error",
1851
-
"code": 2412
1852
-
},
1853
-
"Numeric index type '{0}' is not assignable to string index type '{1}'.": {
1841
+
"'{0}' index type '{1}' is not assignable to '{2}' index type '{3}'.": {
1854
1842
"category": "Error",
1855
1843
"code": 2413
1856
1844
},
@@ -2690,6 +2678,10 @@
2690
2678
"category": "Error",
2691
2679
"code": 2633
2692
2680
},
2681
+
"'{0}' index signatures are incompatible.": {
2682
+
"category": "Error",
2683
+
"code": 2634
2684
+
},
2693
2685
2694
2686
"Cannot augment module '{0}' with value exports because it resolves to a non-module entity.": {
0 commit comments