Disable symbol indexer

This commit is contained in:
Jason Freeman 2015-02-06 21:30:51 -08:00
parent 2f3c32afd6
commit eb5061971d
32 changed files with 154 additions and 156 deletions

View File

@ -10651,15 +10651,7 @@ module ts {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) {
if (parameter.type.kind === SyntaxKind.SymbolKeyword) {
if (languageVersion < ScriptTarget.ES6) {
return grammarErrorOnNode(parameter.type, Diagnostics.symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher);
}
// No error for parameter type
}
else {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_number_or_symbol);
}
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
}
if (!node.type) {
return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation);

View File

@ -19,7 +19,7 @@ module ts {
An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." },
An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." },
An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." },
An_index_signature_parameter_type_must_be_string_number_or_symbol: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string', 'number', or 'symbol'." },
An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." },
A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." },
An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." },
A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." },
@ -147,7 +147,6 @@ module ts {
Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." },
A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." },
A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." },
symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1188, category: DiagnosticCategory.Error, key: "'symbol' indexers are only available when targeting ECMAScript 6 and higher.", isEarly: true },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },

View File

@ -67,7 +67,7 @@
"category": "Error",
"code": 1022
},
"An index signature parameter type must be 'string', 'number', or 'symbol'.": {
"An index signature parameter type must be 'string' or 'number'.": {
"category": "Error",
"code": 1023
},
@ -579,11 +579,6 @@
"category": "Error",
"code": 1187
},
"'symbol' indexers are only available when targeting ECMAScript 6 and higher.": {
"category": "Error",
"code": 1188,
"isEarly": true
},
"Duplicate identifier '{0}'.": {
"category": "Error",

View File

@ -1,4 +1,4 @@
tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string' or 'number'.
tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is not assignable to type 'string[]'.
Type 'void' is not assignable to type 'string'.
tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'.
@ -20,7 +20,7 @@ tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]'
var foo: { [index: any]; }; // expect an error here
~~~~~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}
interface myInt {

View File

@ -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<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C<T>' 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', 'number', or 'symbol'.
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,22): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc
!!! error TS2314: Generic type 'C<T>' requires 1 type argument(s).
declare var d: { [x: C]: C };
~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
~
!!! error TS2314: Generic type 'C<T>' requires 1 type argument(s).
~

View File

@ -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<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C<T>' 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', 'number', or 'symbol'.
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,14): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc
!!! error TS2314: Generic type 'C<T>' requires 1 type argument(s).
var d: { [x: C]: C };
~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
~
!!! error TS2314: Generic type 'C<T>' requires 1 type argument(s).
~

View File

@ -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<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I<T>' 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', 'number', or 'symbol'.
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,14): error TS2314: Generic type 'I<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I<T>' requires 1 type argument(s).
@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc
!!! error TS2314: Generic type 'I<T>' requires 1 type argument(s).
var d: { [x: I]: I };
~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
~
!!! error TS2314: Generic type 'I<T>' requires 1 type argument(s).
~

View File

@ -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<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C<T>' 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', 'number', or 'symbol'.
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,22): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C<T>' requires 1 type argument(s).
@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc
!!! error TS2314: Generic type 'C<T>' requires 1 type argument(s).
declare var d: { [x: C]: C };
~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
~
!!! error TS2314: Generic type 'C<T>' requires 1 type argument(s).
~

View File

@ -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', 'number', or 'symbol'.
tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'.
tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.
@ -58,7 +58,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression
interface Magenta {
[p:Purple]; // error
~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}
var yellow: Yellow;

View File

@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher.
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 (1 errors) ====
interface I {
[s: symbol]: string;
~~~~~~
!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher.
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher.
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 (1 errors) ====
class C {
[s: symbol]: string;
~~~~~~
!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher.
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher.
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 (1 errors) ====
var x: {
[s: symbol]: string;
~~~~~~
!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher.
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
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 (1 errors) ====
interface I {
[a:boolean]
~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,12 +1,12 @@
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
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 (2 errors) ====
var foo: { [index: any]; }; // expect an error here
~~~~~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
var foo2: { [index: RegExp]; }; // expect an error here
~~~~~
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'.
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.

View File

@ -0,0 +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 (1 errors) ====
interface I {
[s: symbol]: string;
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,7 +0,0 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts ===
interface I {
>I : I
[s: symbol]: string;
>s : symbol
}

View File

@ -0,0 +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 (1 errors) ====
class C {
[s: symbol]: string;
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,7 +0,0 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts ===
class C {
>C : C
[s: symbol]: string;
>s : symbol
}

View File

@ -1,9 +1,9 @@
tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,5): error TS1145: Modifiers not permitted on index signature members.
tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,13): error TS1023: An index signature parameter type must be 'string' or 'number'.
==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ====
class C {
static [s: symbol]: string;
~~~~~~
!!! error TS1145: Modifiers not permitted on index signature members.
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -0,0 +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 (1 errors) ====
var x: {
[s: symbol]: string;
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,7 +0,0 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts ===
var x: {
>x : {}
[s: symbol]: string;
>s : symbol
}

View File

@ -0,0 +1,14 @@
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 (1 errors) ====
interface I {
[Symbol.iterator]: number;
[s: symbol]: string;
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
"__@iterator": string;
}
var i: I;
var it = i[Symbol.iterator];

View File

@ -1,27 +0,0 @@
=== tests/cases/conformance/es6/Symbols/symbolProperty17.ts ===
interface I {
>I : I
[Symbol.iterator]: number;
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
[s: symbol]: string;
>s : symbol
"__@iterator": string;
}
var i: I;
>i : I
>I : I
var it = i[Symbol.iterator];
>it : number
>i[Symbol.iterator] : number
>i : I
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol

View File

@ -0,0 +1,12 @@
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 (1 errors) ====
class C1 {
[Symbol.toStringTag]() {
return { x: "" };
}
[s: symbol]: () => { x: string };
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,17 +0,0 @@
=== tests/cases/conformance/es6/Symbols/symbolProperty29.ts ===
class C1 {
>C1 : C1
[Symbol.toStringTag]() {
>Symbol.toStringTag : symbol
>Symbol : SymbolConstructor
>toStringTag : symbol
return { x: "" };
>{ x: "" } : { x: string; }
>x : string
}
[s: symbol]: () => { x: string };
>s : symbol
>x : string
}

View File

@ -0,0 +1,12 @@
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 (1 errors) ====
class C1 {
[Symbol.toStringTag]() {
return { x: "" };
}
[s: symbol]: () => { x: number };
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -0,0 +1,14 @@
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 (1 errors) ====
class C1 {
[Symbol.toStringTag]() {
return { x: "" };
}
}
class C2 extends C1 {
[s: symbol]: () => { x: string };
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,22 +0,0 @@
=== tests/cases/conformance/es6/Symbols/symbolProperty31.ts ===
class C1 {
>C1 : C1
[Symbol.toStringTag]() {
>Symbol.toStringTag : symbol
>Symbol : SymbolConstructor
>toStringTag : symbol
return { x: "" };
>{ x: "" } : { x: string; }
>x : string
}
}
class C2 extends C1 {
>C2 : C2
>C1 : C1
[s: symbol]: () => { x: string };
>s : symbol
>x : string
}

View File

@ -0,0 +1,14 @@
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 (1 errors) ====
class C1 {
[Symbol.toStringTag]() {
return { x: "" };
}
}
class C2 extends C1 {
[s: symbol]: () => { x: number };
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -0,0 +1,14 @@
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 (1 errors) ====
class C1 extends C2 {
[Symbol.toStringTag]() {
return { x: "" };
}
}
class C2 {
[s: symbol]: () => { x: string };
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}

View File

@ -1,22 +0,0 @@
=== tests/cases/conformance/es6/Symbols/symbolProperty33.ts ===
class C1 extends C2 {
>C1 : C1
>C2 : C2
[Symbol.toStringTag]() {
>Symbol.toStringTag : symbol
>Symbol : SymbolConstructor
>toStringTag : symbol
return { x: "" };
>{ x: "" } : { x: string; }
>x : string
}
}
class C2 {
>C2 : C2
[s: symbol]: () => { x: string };
>s : symbol
>x : string
}

View File

@ -0,0 +1,14 @@
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 (1 errors) ====
class C1 extends C2 {
[Symbol.toStringTag]() {
return { x: "" };
}
}
class C2 {
[s: symbol]: () => { x: number };
~
!!! error TS1023: An index signature parameter type must be 'string' or 'number'.
}