From 350e305b0caa92083d4da32a211e82585b91751e Mon Sep 17 00:00:00 2001 From: Troy Tae Date: Wed, 18 Sep 2019 15:34:35 +0900 Subject: [PATCH 1/4] fix: add "either" in code 1023 message --- src/compiler/diagnosticMessages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 86686cb9f6c1b..ac5ef01f86546 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -71,7 +71,7 @@ "category": "Error", "code": 1022 }, - "An index signature parameter type must be 'string' or 'number'.": { + "An index signature parameter type must be either 'string' or 'number'.": { "category": "Error", "code": 1023 }, From a5cda4633bab250114fa24a87d02d495c01e6ef7 Mon Sep 17 00:00:00 2001 From: Troy Tae Date: Wed, 18 Sep 2019 16:19:18 +0900 Subject: [PATCH 2/4] fix: permit string/number literal in union type --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f8c8817888591..5f88cd7bebc56 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -32797,7 +32797,7 @@ namespace ts { typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType)); } - if (type.flags & TypeFlags.Union && allTypesAssignableToKind(type, TypeFlags.StringLiteral, /*strict*/ true)) { + if (type.flags & TypeFlags.Union && allTypesAssignableToKind(type, TypeFlags.StringOrNumberLiteral, /*strict*/ true)) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); } From 56df48d5fac74650ef20fb6a1867820d8b4408b6 Mon Sep 17 00:00:00 2001 From: Troy Tae Date: Wed, 18 Sep 2019 17:19:19 +0900 Subject: [PATCH 3/4] fix: change error1023 key name --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5f88cd7bebc56..3c1c83cb216e6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -32802,7 +32802,7 @@ namespace ts { Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead); } - return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_either_string_or_number); } if (!node.type) { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); From 6a781f5d0cd0b5391b3e86abf717644f78dfb046 Mon Sep 17 00:00:00 2001 From: Troy Tae Date: Wed, 18 Sep 2019 18:02:42 +0900 Subject: [PATCH 4/4] test: update error log --- .../reference/arraySigChecking.errors.txt | 4 ++-- tests/baselines/reference/bigintIndex.errors.txt | 4 ++-- .../declarationEmitIndexTypeNotFound.errors.txt | 4 ++-- ...icIndexTypeHasSensibleErrorMessage.errors.txt | 4 ++-- ...TypeReferenceWithoutTypeArgument.d.errors.txt | 4 ++-- ...icTypeReferenceWithoutTypeArgument.errors.txt | 4 ++-- ...cTypeReferenceWithoutTypeArgument2.errors.txt | 4 ++-- ...cTypeReferenceWithoutTypeArgument3.errors.txt | 4 ++-- .../reference/indexTypeCheck.errors.txt | 4 ++-- .../reference/indexerConstraints2.errors.txt | 16 ++++++++-------- .../reference/parserES5SymbolIndexer1.errors.txt | 4 ++-- .../reference/parserES5SymbolIndexer2.errors.txt | 4 ++-- .../reference/parserES5SymbolIndexer3.errors.txt | 4 ++-- .../reference/parserIndexSignature6.errors.txt | 4 ++-- .../reference/parserIndexSignature8.errors.txt | 8 ++++---- .../reference/parserSymbolIndexer1.errors.txt | 4 ++-- .../reference/parserSymbolIndexer2.errors.txt | 4 ++-- .../reference/parserSymbolIndexer4.errors.txt | 4 ++-- .../reference/symbolProperty17.errors.txt | 4 ++-- .../reference/symbolProperty29.errors.txt | 4 ++-- .../reference/symbolProperty30.errors.txt | 4 ++-- .../reference/symbolProperty31.errors.txt | 4 ++-- .../reference/symbolProperty32.errors.txt | 4 ++-- .../reference/symbolProperty33.errors.txt | 4 ++-- .../reference/symbolProperty34.errors.txt | 4 ++-- 25 files changed, 58 insertions(+), 58 deletions(-) diff --git a/tests/baselines/reference/arraySigChecking.errors.txt b/tests/baselines/reference/arraySigChecking.errors.txt index a1f219919d8be..5bf4cfdd58e07 100644 --- a/tests/baselines/reference/arraySigChecking.errors.txt +++ b/tests/baselines/reference/arraySigChecking.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/arraySigChecking.ts(18,27): error TS2322: Type 'void' is not assignable to type 'string'. tests/cases/compiler/arraySigChecking.ts(22,13): error TS2322: Type 'number' is not assignable to type 'number[]'. tests/cases/compiler/arraySigChecking.ts(22,16): error TS2322: Type 'number' is not assignable to type 'number[]'. @@ -17,7 +17,7 @@ tests/cases/compiler/arraySigChecking.ts(22,16): error TS2322: Type 'number' is var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } interface myInt { diff --git a/tests/baselines/reference/bigintIndex.errors.txt b/tests/baselines/reference/bigintIndex.errors.txt index 50e360a190589..9630692d723ac 100644 --- a/tests/baselines/reference/bigintIndex.errors.txt +++ b/tests/baselines/reference/bigintIndex.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/a.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/a.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/a.ts(8,11): error TS2538: Type '1n' cannot be used as an index type. tests/cases/compiler/a.ts(14,1): error TS2322: Type '123n' is not assignable to type 'string | number | symbol'. tests/cases/compiler/a.ts(19,12): error TS2538: Type 'bigint' cannot be used as an index type. @@ -13,7 +13,7 @@ tests/cases/compiler/b.ts(4,12): error TS2464: A computed property name must be interface BigIntIndex { [index: bigint]: E; // should error ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } const arr: number[] = [1, 2, 3]; diff --git a/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt b/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt index 435ddd7c069e7..2e116a25861e2 100644 --- a/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt +++ b/tests/baselines/reference/declarationEmitIndexTypeNotFound.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(2,13): error TS2304: Cannot find name 'TypeNotFound'. tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(2,13): error TS4092: Parameter 'index' of index signature from exported interface has or is using private name 'TypeNotFound'. @@ -7,7 +7,7 @@ tests/cases/compiler/declarationEmitIndexTypeNotFound.ts(2,13): error TS4092: Pa export interface Test { [index: TypeNotFound]: any; ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. ~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'TypeNotFound'. ~~~~~~~~~~~~ diff --git a/tests/baselines/reference/genericIndexTypeHasSensibleErrorMessage.errors.txt b/tests/baselines/reference/genericIndexTypeHasSensibleErrorMessage.errors.txt index ebcfc8d148273..36f2bf9fbdaf7 100644 --- a/tests/baselines/reference/genericIndexTypeHasSensibleErrorMessage.errors.txt +++ b/tests/baselines/reference/genericIndexTypeHasSensibleErrorMessage.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/genericIndexTypeHasSensibleErrorMessage.ts(1,33): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/genericIndexTypeHasSensibleErrorMessage.ts(1,33): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/compiler/genericIndexTypeHasSensibleErrorMessage.ts (1 errors) ==== type Wat = { [x: T]: string }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. \ No newline at end of file +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt index 2f6db48bf2fa4..14107cde7e176 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt index d57f3c2fc0d03..68d91622a310f 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(10,13): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index 276654562a1ec..7a63caeaf670c 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(10,13): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'I' requires 1 type argument(s). var d: { [x: I]: I }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. ~ !!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt index 95857c925be91..bb6ee2494add0 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 9d839e9eb3022..c5c16f5ecd914 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. -tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/indexTypeCheck.ts(51,8): error TS2538: Type 'Blue' cannot be used as an index type. @@ -58,7 +58,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,8): error TS2538: Type 'Blue' cannot b interface Magenta { [p:Purple]; // error ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } var yellow: Yellow; diff --git a/tests/baselines/reference/indexerConstraints2.errors.txt b/tests/baselines/reference/indexerConstraints2.errors.txt index aca2af28adc12..b3bd692122efd 100644 --- a/tests/baselines/reference/indexerConstraints2.errors.txt +++ b/tests/baselines/reference/indexerConstraints2.errors.txt @@ -3,11 +3,11 @@ tests/cases/compiler/indexerConstraints2.ts(17,5): error TS2413: Numeric index t tests/cases/compiler/indexerConstraints2.ts(26,5): error TS2413: Numeric index type 'A' is not assignable to string index type 'B'. tests/cases/compiler/indexerConstraints2.ts(34,6): error TS1336: An index signature parameter type cannot be a type alias. Consider writing '[n: number]: A' instead. tests/cases/compiler/indexerConstraints2.ts(40,6): error TS1336: An index signature parameter type cannot be a type alias. Consider writing '[s: string]: A' instead. -tests/cases/compiler/indexerConstraints2.ts(46,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/indexerConstraints2.ts(46,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. tests/cases/compiler/indexerConstraints2.ts(52,6): error TS1337: An index signature parameter type cannot be a union type. Consider using a mapped object type instead. -tests/cases/compiler/indexerConstraints2.ts(58,6): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/compiler/indexerConstraints2.ts(64,6): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/compiler/indexerConstraints2.ts(70,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/indexerConstraints2.ts(58,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. +tests/cases/compiler/indexerConstraints2.ts(64,6): error TS1337: An index signature parameter type cannot be a union type. Consider using a mapped object type instead. +tests/cases/compiler/indexerConstraints2.ts(70,6): error TS1337: An index signature parameter type cannot be a union type. Consider using a mapped object type instead. tests/cases/compiler/indexerConstraints2.ts(74,6): error TS1337: An index signature parameter type cannot be a union type. Consider using a mapped object type instead. tests/cases/compiler/indexerConstraints2.ts(79,6): error TS1336: An index signature parameter type cannot be a type alias. Consider writing '[key: string]: any' instead. @@ -70,7 +70,7 @@ tests/cases/compiler/indexerConstraints2.ts(79,6): error TS1336: An index signat interface N { [b: AliasedBoolean]: A; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } type IndexableUnion = "foo" | "bar"; @@ -86,7 +86,7 @@ tests/cases/compiler/indexerConstraints2.ts(79,6): error TS1336: An index signat interface P { [u: NonIndexableUnion]: A; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } type NonIndexableUnion2 = string | number; @@ -94,7 +94,7 @@ tests/cases/compiler/indexerConstraints2.ts(79,6): error TS1336: An index signat interface Q { [u: NonIndexableUnion2]: A; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1337: An index signature parameter type cannot be a union type. Consider using a mapped object type instead. } type NonIndexableUnion3 = "foo" | 42; @@ -102,7 +102,7 @@ tests/cases/compiler/indexerConstraints2.ts(79,6): error TS1336: An index signat interface R { [u: NonIndexableUnion3]: A; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1337: An index signature parameter type cannot be a union type. Consider using a mapped object type instead. } interface S { diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt index adfac8f700f2f..a0010dc0a27a4 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (1 errors) ==== interface I { [s: symbol]: string; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt index 12eef8ec04967..acc43ed9b74e2 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (1 errors) ==== class C { [s: symbol]: string; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt index c9cd9db4fab8b..12d8819c60130 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (1 errors) ==== var x: { [s: symbol]: string; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature6.errors.txt b/tests/baselines/reference/parserIndexSignature6.errors.txt index db53f219832ed..9df13e05b6c87 100644 --- a/tests/baselines/reference/parserIndexSignature6.errors.txt +++ b/tests/baselines/reference/parserIndexSignature6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts (1 errors) ==== interface I { [a:boolean] ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature8.errors.txt b/tests/baselines/reference/parserIndexSignature8.errors.txt index 87369df1b76c7..5ca6f11573fee 100644 --- a/tests/baselines/reference/parserIndexSignature8.errors.txt +++ b/tests/baselines/reference/parserIndexSignature8.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be either 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts (2 errors) ==== var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. var foo2: { [index: RegExp]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.errors.txt b/tests/baselines/reference/parserSymbolIndexer1.errors.txt index 5c6c38d52b122..b9a34890151d7 100644 --- a/tests/baselines/reference/parserSymbolIndexer1.errors.txt +++ b/tests/baselines/reference/parserSymbolIndexer1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts (1 errors) ==== interface I { [s: symbol]: string; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer2.errors.txt b/tests/baselines/reference/parserSymbolIndexer2.errors.txt index 3961f4942de4b..3b8735feef9ac 100644 --- a/tests/baselines/reference/parserSymbolIndexer2.errors.txt +++ b/tests/baselines/reference/parserSymbolIndexer2.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts (1 errors) ==== class C { [s: symbol]: string; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer4.errors.txt b/tests/baselines/reference/parserSymbolIndexer4.errors.txt index 1cf184a48472b..4da102891a0fd 100644 --- a/tests/baselines/reference/parserSymbolIndexer4.errors.txt +++ b/tests/baselines/reference/parserSymbolIndexer4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts(2,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts (1 errors) ==== var x: { [s: symbol]: string; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty17.errors.txt b/tests/baselines/reference/symbolProperty17.errors.txt index 51f77646f0db7..a28a1d0981041 100644 --- a/tests/baselines/reference/symbolProperty17.errors.txt +++ b/tests/baselines/reference/symbolProperty17.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolProperty17.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty17.ts(3,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty17.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/conformance/es6/Symbols/symbolProperty17.ts(3,6): error TS1023: An i [Symbol.iterator]: number; [s: symbol]: string; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. "__@iterator": string; } diff --git a/tests/baselines/reference/symbolProperty29.errors.txt b/tests/baselines/reference/symbolProperty29.errors.txt index 1efaeb2b3bfb8..b0f6bb3bc3169 100644 --- a/tests/baselines/reference/symbolProperty29.errors.txt +++ b/tests/baselines/reference/symbolProperty29.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolProperty29.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty29.ts(5,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty29.ts (1 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty29.ts(5,6): error TS1023: An i } [s: symbol]: () => { x: string }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty30.errors.txt b/tests/baselines/reference/symbolProperty30.errors.txt index b839d11d1b803..c986fd28641be 100644 --- a/tests/baselines/reference/symbolProperty30.errors.txt +++ b/tests/baselines/reference/symbolProperty30.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolProperty30.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty30.ts(5,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty30.ts (1 errors) ==== @@ -8,5 +8,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty30.ts(5,6): error TS1023: An i } [s: symbol]: () => { x: number }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty31.errors.txt b/tests/baselines/reference/symbolProperty31.errors.txt index 39735c017b2ad..46a6177809016 100644 --- a/tests/baselines/reference/symbolProperty31.errors.txt +++ b/tests/baselines/reference/symbolProperty31.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolProperty31.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty31.ts(7,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty31.ts (1 errors) ==== @@ -10,5 +10,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty31.ts(7,6): error TS1023: An i class C2 extends C1 { [s: symbol]: () => { x: string }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty32.errors.txt b/tests/baselines/reference/symbolProperty32.errors.txt index 4051f8f91c84b..3318459b29404 100644 --- a/tests/baselines/reference/symbolProperty32.errors.txt +++ b/tests/baselines/reference/symbolProperty32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/Symbols/symbolProperty32.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty32.ts(7,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty32.ts (1 errors) ==== @@ -10,5 +10,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty32.ts(7,6): error TS1023: An i class C2 extends C1 { [s: symbol]: () => { x: number }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt index 5c23a80f8ca7f..09b32a501ce93 100644 --- a/tests/baselines/reference/symbolProperty33.errors.txt +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty33.ts(1,18): error TS2449: Class 'C2' used before its declaration. -tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty33.ts (2 errors) ==== @@ -14,5 +14,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An i class C2 { [s: symbol]: () => { x: string }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt index bd909ae3b68c5..390ead2177f04 100644 --- a/tests/baselines/reference/symbolProperty34.errors.txt +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty34.ts(1,18): error TS2449: Class 'C2' used before its declaration. -tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be either 'string' or 'number'. ==== tests/cases/conformance/es6/Symbols/symbolProperty34.ts (2 errors) ==== @@ -14,5 +14,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An i class C2 { [s: symbol]: () => { x: number }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be either 'string' or 'number'. } \ No newline at end of file