Allow Symbol indexer in ES6

This commit is contained in:
Jason Freeman 2015-01-26 14:34:22 -08:00
parent ff31b96533
commit 11d75ef4ce
31 changed files with 195 additions and 28 deletions

View File

@ -10472,25 +10472,33 @@ module ts {
return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter);
}
}
else if (parameter.dotDotDotToken) {
if (parameter.dotDotDotToken) {
return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter);
}
else if (parameter.flags & NodeFlags.Modifier) {
if (parameter.flags & NodeFlags.Modifier) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier);
}
else if (parameter.questionToken) {
if (parameter.questionToken) {
return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark);
}
else if (parameter.initializer) {
if (parameter.initializer) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer);
}
else if (!parameter.type) {
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
else if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) {
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) {
if (isESSymbolTypeNode(parameter.type)) {
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);
}
}
else if (!node.type) {
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_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." },
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'." },
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,6 +147,7 @@ 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' or 'number'.": {
"An index signature parameter type must be 'string', 'number', or 'Symbol'.": {
"category": "Error",
"code": 1023
},
@ -579,6 +579,11 @@
"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

@ -835,6 +835,13 @@ module ts {
return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken;
}
export function isESSymbolTypeNode(node: Node): boolean {
return node.kind === SyntaxKind.TypeReference &&
(<TypeReferenceNode>node).typeArguments === undefined &&
(<TypeReferenceNode>node).typeName.kind === SyntaxKind.Identifier &&
(<Identifier>(<TypeReferenceNode>node).typeName).text === "Symbol";
}
export function isModifier(token: SyntaxKind): boolean {
switch (token) {
case SyntaxKind.PublicKeyword:

View File

@ -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 'string', 'number', or 'Symbol'.
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' or 'number'.
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'.
}
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' or 'number'.
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,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' or 'number'.
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'.
~
!!! 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' or 'number'.
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,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' or 'number'.
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'.
~
!!! 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' or 'number'.
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,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' or 'number'.
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'.
~
!!! 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' or 'number'.
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,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' or 'number'.
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'.
~
!!! 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' or 'number'.
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(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 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' or 'number'.
!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'.
}
var yellow: Yellow;

View File

@ -0,0 +1,12 @@
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,9): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (2 errors) ====
interface I {
[s: Symbol]: string;
~~~~~~
!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher.
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
}

View File

@ -0,0 +1,12 @@
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,9): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (2 errors) ====
class C {
[s: Symbol]: string;
~~~~~~
!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher.
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
}

View File

@ -0,0 +1,12 @@
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,9): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (2 errors) ====
var x: {
[s: Symbol]: string;
~~~~~~
!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher.
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
}

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' or 'number'.
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 (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 'string', 'number', or 'Symbol'.
}

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' 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 '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 (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 'string', 'number', or 'Symbol'.
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 'string', 'number', or 'Symbol'.

View File

@ -0,0 +1,6 @@
//// [parserSymbolIndexer1.ts]
interface I {
[s: Symbol]: string;
}
//// [parserSymbolIndexer1.js]

View File

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

View File

@ -0,0 +1,11 @@
//// [parserSymbolIndexer2.ts]
class C {
[s: Symbol]: string;
}
//// [parserSymbolIndexer2.js]
var C = (function () {
function C() {
}
return C;
})();

View File

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

View File

@ -0,0 +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 (1 errors) ====
class C {
static [s: Symbol]: string;
~~~~~~
!!! error TS1145: Modifiers not permitted on index signature members.
}

View File

@ -0,0 +1,7 @@
//// [parserSymbolIndexer4.ts]
var x: {
[s: Symbol]: string;
}
//// [parserSymbolIndexer4.js]
var x;

View File

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

View File

@ -0,0 +1,21 @@
tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,6): error TS2304: Cannot find name 's'.
tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,7): error TS1005: ']' expected.
tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,15): error TS1005: ',' expected.
tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,16): error TS1136: Property assignment expected.
tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(3,1): error TS1005: ':' expected.
==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts (5 errors) ====
var x = {
[s: Symbol]: ""
~
!!! error TS2304: Cannot find name 's'.
~
!!! error TS1005: ']' expected.
~
!!! error TS1005: ',' expected.
~
!!! error TS1136: Property assignment expected.
}
~
!!! error TS1005: ':' expected.

View File

@ -0,0 +1,4 @@
//@target: ES5
interface I {
[s: Symbol]: string;
}

View File

@ -0,0 +1,4 @@
//@target: ES5
class C {
[s: Symbol]: string;
}

View File

@ -0,0 +1,4 @@
//@target: ES5
var x: {
[s: Symbol]: string;
}

View File

@ -0,0 +1,4 @@
//@target: ES6
interface I {
[s: Symbol]: string;
}

View File

@ -0,0 +1,4 @@
//@target: ES6
class C {
[s: Symbol]: string;
}

View File

@ -0,0 +1,4 @@
//@target: ES6
class C {
static [s: Symbol]: string;
}

View File

@ -0,0 +1,4 @@
//@target: ES6
var x: {
[s: Symbol]: string;
}

View File

@ -0,0 +1,4 @@
//@target: ES6
var x = {
[s: Symbol]: ""
}