Support TS 4.3 static index signature in classes (#13096)
This commit is contained in:
parent
0ee98139a6
commit
eac0259ce2
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
|||||||
FLOW_COMMIT = a1f9a4c709dcebb27a5084acf47755fbae699c25
|
FLOW_COMMIT = a1f9a4c709dcebb27a5084acf47755fbae699c25
|
||||||
TEST262_COMMIT = eca69e2c95972a4c5780ef58fe1f1e53e871b9b1
|
TEST262_COMMIT = eca69e2c95972a4c5780ef58fe1f1e53e871b9b1
|
||||||
TYPESCRIPT_COMMIT = da8633212023517630de5f3620a23736b63234b1
|
TYPESCRIPT_COMMIT = 41dc625b0a609eb294b975dd92675e72b2b3fdec
|
||||||
|
|
||||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||||
export FORCE_COLOR = true
|
export FORCE_COLOR = true
|
||||||
|
|||||||
@ -133,7 +133,11 @@ export function TSMethodSignature(this: Printer, node: t.TSMethodSignature) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function TSIndexSignature(this: Printer, node: t.TSIndexSignature) {
|
export function TSIndexSignature(this: Printer, node: t.TSIndexSignature) {
|
||||||
const { readonly } = node;
|
const { readonly, static: isStatic } = node;
|
||||||
|
if (isStatic) {
|
||||||
|
this.word("static");
|
||||||
|
this.space();
|
||||||
|
}
|
||||||
if (readonly) {
|
if (readonly) {
|
||||||
this.word("readonly");
|
this.word("readonly");
|
||||||
this.space();
|
this.space();
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
class C {
|
class C {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
readonly [x: string]: any;
|
readonly [x: string]: any;
|
||||||
|
static [x: string]: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
class C {
|
class C {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
readonly [x: string]: any;
|
readonly [x: string]: any;
|
||||||
|
static [x: string]: any;
|
||||||
}
|
}
|
||||||
@ -96,6 +96,7 @@ const TSErrors = makeErrorTemplates(
|
|||||||
"Index signatures cannot have the 'static' modifier",
|
"Index signatures cannot have the 'static' modifier",
|
||||||
InvalidModifierOnTypeMember:
|
InvalidModifierOnTypeMember:
|
||||||
"'%0' modifier cannot appear on a type member.",
|
"'%0' modifier cannot appear on a type member.",
|
||||||
|
InvalidModifiersOrder: "'%0' modifier must precede '%1' modifier.",
|
||||||
InvalidTupleMemberLabel:
|
InvalidTupleMemberLabel:
|
||||||
"Tuple members must be labeled with a simple identifier.",
|
"Tuple members must be labeled with a simple identifier.",
|
||||||
MixedLabeledAndUnlabeledElements:
|
MixedLabeledAndUnlabeledElements:
|
||||||
@ -249,6 +250,13 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
} else {
|
} else {
|
||||||
if (Object.hasOwnProperty.call(modified, modifier)) {
|
if (Object.hasOwnProperty.call(modified, modifier)) {
|
||||||
this.raise(startPos, TSErrors.DuplicateModifier, modifier);
|
this.raise(startPos, TSErrors.DuplicateModifier, modifier);
|
||||||
|
} else if (modified.readonly && modifier === "static") {
|
||||||
|
this.raise(
|
||||||
|
startPos,
|
||||||
|
TSErrors.InvalidModifiersOrder,
|
||||||
|
"static",
|
||||||
|
"readonly",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
modified[modifier] = true;
|
modified[modifier] = true;
|
||||||
}
|
}
|
||||||
@ -2233,7 +2241,16 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
state: N.ParseClassMemberState,
|
state: N.ParseClassMemberState,
|
||||||
isStatic: boolean,
|
isStatic: boolean,
|
||||||
): void {
|
): void {
|
||||||
this.tsParseModifiers(member, ["abstract", "readonly", "declare"]);
|
this.tsParseModifiers(member, [
|
||||||
|
"abstract",
|
||||||
|
"readonly",
|
||||||
|
"declare",
|
||||||
|
"static",
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (isStatic) {
|
||||||
|
member.static = true;
|
||||||
|
}
|
||||||
|
|
||||||
const idx = this.tsTryParseIndexSignature(member);
|
const idx = this.tsTryParseIndexSignature(member);
|
||||||
if (idx) {
|
if (idx) {
|
||||||
@ -2242,9 +2259,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
if ((member: any).abstract) {
|
if ((member: any).abstract) {
|
||||||
this.raise(member.start, TSErrors.IndexSignatureHasAbstract);
|
this.raise(member.start, TSErrors.IndexSignatureHasAbstract);
|
||||||
}
|
}
|
||||||
if (isStatic) {
|
|
||||||
this.raise(member.start, TSErrors.IndexSignatureHasStatic);
|
|
||||||
}
|
|
||||||
if ((member: any).accessibility) {
|
if ((member: any).accessibility) {
|
||||||
this.raise(
|
this.raise(
|
||||||
member.start,
|
member.start,
|
||||||
|
|||||||
@ -1205,6 +1205,7 @@ export type TsMethodSignature = TsSignatureDeclarationBase &
|
|||||||
// *Not* a ClassMemberBase: Can't have accessibility, can't be abstract, can't be optional.
|
// *Not* a ClassMemberBase: Can't have accessibility, can't be abstract, can't be optional.
|
||||||
export type TsIndexSignature = TsSignatureDeclarationOrIndexSignatureBase & {
|
export type TsIndexSignature = TsSignatureDeclarationOrIndexSignatureBase & {
|
||||||
readonly?: true,
|
readonly?: true,
|
||||||
|
static?: true,
|
||||||
type: "TSIndexSignature",
|
type: "TSIndexSignature",
|
||||||
// Note: parameters.length must be 1.
|
// Note: parameters.length must be 1.
|
||||||
};
|
};
|
||||||
|
|||||||
3
packages/babel-parser/test/fixtures/typescript/class/index-signature-errors/input.ts
vendored
Normal file
3
packages/babel-parser/test/fixtures/typescript/class/index-signature-errors/input.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class C {
|
||||||
|
readonly static [x: string]: any;
|
||||||
|
}
|
||||||
61
packages/babel-parser/test/fixtures/typescript/class/index-signature-errors/output.json
vendored
Normal file
61
packages/babel-parser/test/fixtures/typescript/class/index-signature-errors/output.json
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||||
|
"errors": [
|
||||||
|
"SyntaxError: 'static' modifier must precede 'readonly' modifier. (2:13)"
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||||
|
"sourceType": "module",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ClassDeclaration",
|
||||||
|
"start":0,"end":49,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
|
||||||
|
"name": "C"
|
||||||
|
},
|
||||||
|
"superClass": null,
|
||||||
|
"body": {
|
||||||
|
"type": "ClassBody",
|
||||||
|
"start":8,"end":49,"loc":{"start":{"line":1,"column":8},"end":{"line":3,"column":1}},
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "TSIndexSignature",
|
||||||
|
"start":14,"end":47,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":37}},
|
||||||
|
"readonly": true,
|
||||||
|
"static": true,
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":31,"end":40,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":30},"identifierName":"x"},
|
||||||
|
"name": "x",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start":32,"end":40,"loc":{"start":{"line":2,"column":22},"end":{"line":2,"column":30}},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSStringKeyword",
|
||||||
|
"start":34,"end":40,"loc":{"start":{"line":2,"column":24},"end":{"line":2,"column":30}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start":41,"end":46,"loc":{"start":{"line":2,"column":31},"end":{"line":2,"column":36}},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSAnyKeyword",
|
||||||
|
"start":43,"end":46,"loc":{"start":{"line":2,"column":33},"end":{"line":2,"column":36}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,6 @@
|
|||||||
class C {
|
class C {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
readonly [x: string]: any;
|
readonly [x: string]: any;
|
||||||
|
static [x: string]: any;
|
||||||
|
static readonly [x: string]: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"type": "File",
|
"type": "File",
|
||||||
"start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
"start":0,"end":131,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
|
||||||
"program": {
|
"program": {
|
||||||
"type": "Program",
|
"type": "Program",
|
||||||
"start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
"start":0,"end":131,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
|
||||||
"sourceType": "module",
|
"sourceType": "module",
|
||||||
"interpreter": null,
|
"interpreter": null,
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "ClassDeclaration",
|
"type": "ClassDeclaration",
|
||||||
"start":0,"end":64,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":1}},
|
"start":0,"end":131,"loc":{"start":{"line":1,"column":0},"end":{"line":6,"column":1}},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
|
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
|
||||||
@ -18,7 +18,7 @@
|
|||||||
"superClass": null,
|
"superClass": null,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "ClassBody",
|
"type": "ClassBody",
|
||||||
"start":8,"end":64,"loc":{"start":{"line":1,"column":8},"end":{"line":4,"column":1}},
|
"start":8,"end":131,"loc":{"start":{"line":1,"column":8},"end":{"line":6,"column":1}},
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "TSIndexSignature",
|
"type": "TSIndexSignature",
|
||||||
@ -74,6 +74,63 @@
|
|||||||
"start":58,"end":61,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":29}}
|
"start":58,"end":61,"loc":{"start":{"line":3,"column":26},"end":{"line":3,"column":29}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TSIndexSignature",
|
||||||
|
"start":67,"end":91,"loc":{"start":{"line":4,"column":4},"end":{"line":4,"column":28}},
|
||||||
|
"static": true,
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":75,"end":84,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":21},"identifierName":"x"},
|
||||||
|
"name": "x",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start":76,"end":84,"loc":{"start":{"line":4,"column":13},"end":{"line":4,"column":21}},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSStringKeyword",
|
||||||
|
"start":78,"end":84,"loc":{"start":{"line":4,"column":15},"end":{"line":4,"column":21}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start":85,"end":90,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":27}},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSAnyKeyword",
|
||||||
|
"start":87,"end":90,"loc":{"start":{"line":4,"column":24},"end":{"line":4,"column":27}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TSIndexSignature",
|
||||||
|
"start":96,"end":129,"loc":{"start":{"line":5,"column":4},"end":{"line":5,"column":37}},
|
||||||
|
"readonly": true,
|
||||||
|
"static": true,
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":113,"end":122,"loc":{"start":{"line":5,"column":21},"end":{"line":5,"column":30},"identifierName":"x"},
|
||||||
|
"name": "x",
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start":114,"end":122,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":30}},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSStringKeyword",
|
||||||
|
"start":116,"end":122,"loc":{"start":{"line":5,"column":24},"end":{"line":5,"column":30}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSTypeAnnotation",
|
||||||
|
"start":123,"end":128,"loc":{"start":{"line":5,"column":31},"end":{"line":5,"column":36}},
|
||||||
|
"typeAnnotation": {
|
||||||
|
"type": "TSAnyKeyword",
|
||||||
|
"start":125,"end":128,"loc":{"start":{"line":5,"column":33},"end":{"line":5,"column":36}}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
class C {
|
class C {
|
||||||
abstract [key: string]: string;
|
abstract [key: string]: string;
|
||||||
static [key: string]: string;
|
|
||||||
declare [key: string]: string;
|
declare [key: string]: string;
|
||||||
private [key: string]: string;
|
private [key: string]: string;
|
||||||
public [key: string]: string;
|
public [key: string]: string;
|
||||||
|
|||||||
@ -1,23 +1,22 @@
|
|||||||
{
|
{
|
||||||
"type": "File",
|
"type": "File",
|
||||||
"start":0,"end":210,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}},
|
"start":0,"end":178,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
|
||||||
"errors": [
|
"errors": [
|
||||||
"SyntaxError: Index signatures cannot have the 'abstract' modifier (2:2)",
|
"SyntaxError: Index signatures cannot have the 'abstract' modifier (2:2)",
|
||||||
"SyntaxError: Index signatures cannot have the 'static' modifier (3:2)",
|
"SyntaxError: Index signatures cannot have the 'declare' modifier (3:2)",
|
||||||
"SyntaxError: Index signatures cannot have the 'declare' modifier (4:2)",
|
"SyntaxError: Index signatures cannot have an accessibility modifier ('private') (4:2)",
|
||||||
"SyntaxError: Index signatures cannot have an accessibility modifier ('private') (5:2)",
|
"SyntaxError: Index signatures cannot have an accessibility modifier ('public') (5:2)",
|
||||||
"SyntaxError: Index signatures cannot have an accessibility modifier ('public') (6:2)",
|
"SyntaxError: Index signatures cannot have an accessibility modifier ('protected') (6:2)"
|
||||||
"SyntaxError: Index signatures cannot have an accessibility modifier ('protected') (7:2)"
|
|
||||||
],
|
],
|
||||||
"program": {
|
"program": {
|
||||||
"type": "Program",
|
"type": "Program",
|
||||||
"start":0,"end":210,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}},
|
"start":0,"end":178,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
|
||||||
"sourceType": "module",
|
"sourceType": "module",
|
||||||
"interpreter": null,
|
"interpreter": null,
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "ClassDeclaration",
|
"type": "ClassDeclaration",
|
||||||
"start":0,"end":210,"loc":{"start":{"line":1,"column":0},"end":{"line":8,"column":1}},
|
"start":0,"end":178,"loc":{"start":{"line":1,"column":0},"end":{"line":7,"column":1}},
|
||||||
"id": {
|
"id": {
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
|
"start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7},"identifierName":"C"},
|
||||||
@ -26,7 +25,7 @@
|
|||||||
"superClass": null,
|
"superClass": null,
|
||||||
"body": {
|
"body": {
|
||||||
"type": "ClassBody",
|
"type": "ClassBody",
|
||||||
"start":8,"end":210,"loc":{"start":{"line":1,"column":8},"end":{"line":8,"column":1}},
|
"start":8,"end":178,"loc":{"start":{"line":1,"column":8},"end":{"line":7,"column":1}},
|
||||||
"body": [
|
"body": [
|
||||||
{
|
{
|
||||||
"type": "TSIndexSignature",
|
"type": "TSIndexSignature",
|
||||||
@ -58,140 +57,113 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "TSIndexSignature",
|
"type": "TSIndexSignature",
|
||||||
"start":46,"end":75,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":31}},
|
"start":46,"end":76,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":32}},
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":54,"end":65,"loc":{"start":{"line":3,"column":10},"end":{"line":3,"column":21},"identifierName":"key"},
|
|
||||||
"name": "key",
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeAnnotation",
|
|
||||||
"start":57,"end":65,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":21}},
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSStringKeyword",
|
|
||||||
"start":59,"end":65,"loc":{"start":{"line":3,"column":15},"end":{"line":3,"column":21}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSTypeAnnotation",
|
|
||||||
"start":66,"end":74,"loc":{"start":{"line":3,"column":22},"end":{"line":3,"column":30}},
|
|
||||||
"typeAnnotation": {
|
|
||||||
"type": "TSStringKeyword",
|
|
||||||
"start":68,"end":74,"loc":{"start":{"line":3,"column":24},"end":{"line":3,"column":30}}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TSIndexSignature",
|
|
||||||
"start":78,"end":108,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":32}},
|
|
||||||
"declare": true,
|
"declare": true,
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start":87,"end":98,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":22},"identifierName":"key"},
|
"start":55,"end":66,"loc":{"start":{"line":3,"column":11},"end":{"line":3,"column":22},"identifierName":"key"},
|
||||||
"name": "key",
|
"name": "key",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":90,"end":98,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":22}},
|
"start":58,"end":66,"loc":{"start":{"line":3,"column":14},"end":{"line":3,"column":22}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":92,"end":98,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":22}}
|
"start":60,"end":66,"loc":{"start":{"line":3,"column":16},"end":{"line":3,"column":22}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":99,"end":107,"loc":{"start":{"line":4,"column":23},"end":{"line":4,"column":31}},
|
"start":67,"end":75,"loc":{"start":{"line":3,"column":23},"end":{"line":3,"column":31}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":101,"end":107,"loc":{"start":{"line":4,"column":25},"end":{"line":4,"column":31}}
|
"start":69,"end":75,"loc":{"start":{"line":3,"column":25},"end":{"line":3,"column":31}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "TSIndexSignature",
|
"type": "TSIndexSignature",
|
||||||
"start":111,"end":141,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":32}},
|
"start":79,"end":109,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":32}},
|
||||||
"accessibility": "private",
|
"accessibility": "private",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start":120,"end":131,"loc":{"start":{"line":5,"column":11},"end":{"line":5,"column":22},"identifierName":"key"},
|
"start":88,"end":99,"loc":{"start":{"line":4,"column":11},"end":{"line":4,"column":22},"identifierName":"key"},
|
||||||
"name": "key",
|
"name": "key",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":123,"end":131,"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":22}},
|
"start":91,"end":99,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":22}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":125,"end":131,"loc":{"start":{"line":5,"column":16},"end":{"line":5,"column":22}}
|
"start":93,"end":99,"loc":{"start":{"line":4,"column":16},"end":{"line":4,"column":22}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":132,"end":140,"loc":{"start":{"line":5,"column":23},"end":{"line":5,"column":31}},
|
"start":100,"end":108,"loc":{"start":{"line":4,"column":23},"end":{"line":4,"column":31}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":134,"end":140,"loc":{"start":{"line":5,"column":25},"end":{"line":5,"column":31}}
|
"start":102,"end":108,"loc":{"start":{"line":4,"column":25},"end":{"line":4,"column":31}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "TSIndexSignature",
|
"type": "TSIndexSignature",
|
||||||
"start":144,"end":173,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":31}},
|
"start":112,"end":141,"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":31}},
|
||||||
"accessibility": "public",
|
"accessibility": "public",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start":152,"end":163,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":21},"identifierName":"key"},
|
"start":120,"end":131,"loc":{"start":{"line":5,"column":10},"end":{"line":5,"column":21},"identifierName":"key"},
|
||||||
"name": "key",
|
"name": "key",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":155,"end":163,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":21}},
|
"start":123,"end":131,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":21}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":157,"end":163,"loc":{"start":{"line":6,"column":15},"end":{"line":6,"column":21}}
|
"start":125,"end":131,"loc":{"start":{"line":5,"column":15},"end":{"line":5,"column":21}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":164,"end":172,"loc":{"start":{"line":6,"column":22},"end":{"line":6,"column":30}},
|
"start":132,"end":140,"loc":{"start":{"line":5,"column":22},"end":{"line":5,"column":30}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":166,"end":172,"loc":{"start":{"line":6,"column":24},"end":{"line":6,"column":30}}
|
"start":134,"end":140,"loc":{"start":{"line":5,"column":24},"end":{"line":5,"column":30}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "TSIndexSignature",
|
"type": "TSIndexSignature",
|
||||||
"start":176,"end":208,"loc":{"start":{"line":7,"column":2},"end":{"line":7,"column":34}},
|
"start":144,"end":176,"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":34}},
|
||||||
"accessibility": "protected",
|
"accessibility": "protected",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "Identifier",
|
"type": "Identifier",
|
||||||
"start":187,"end":198,"loc":{"start":{"line":7,"column":13},"end":{"line":7,"column":24},"identifierName":"key"},
|
"start":155,"end":166,"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":24},"identifierName":"key"},
|
||||||
"name": "key",
|
"name": "key",
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":190,"end":198,"loc":{"start":{"line":7,"column":16},"end":{"line":7,"column":24}},
|
"start":158,"end":166,"loc":{"start":{"line":6,"column":16},"end":{"line":6,"column":24}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":192,"end":198,"loc":{"start":{"line":7,"column":18},"end":{"line":7,"column":24}}
|
"start":160,"end":166,"loc":{"start":{"line":6,"column":18},"end":{"line":6,"column":24}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSTypeAnnotation",
|
"type": "TSTypeAnnotation",
|
||||||
"start":199,"end":207,"loc":{"start":{"line":7,"column":25},"end":{"line":7,"column":33}},
|
"start":167,"end":175,"loc":{"start":{"line":6,"column":25},"end":{"line":6,"column":33}},
|
||||||
"typeAnnotation": {
|
"typeAnnotation": {
|
||||||
"type": "TSStringKeyword",
|
"type": "TSStringKeyword",
|
||||||
"start":201,"end":207,"loc":{"start":{"line":7,"column":27},"end":{"line":7,"column":33}}
|
"start":169,"end":175,"loc":{"start":{"line":6,"column":27},"end":{"line":6,"column":33}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1709,6 +1709,7 @@ export interface TSIndexSignature extends BaseNode {
|
|||||||
parameters: Array<Identifier>;
|
parameters: Array<Identifier>;
|
||||||
typeAnnotation?: TSTypeAnnotation | null;
|
typeAnnotation?: TSTypeAnnotation | null;
|
||||||
readonly?: boolean | null;
|
readonly?: boolean | null;
|
||||||
|
static?: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TSAnyKeyword extends BaseNode {
|
export interface TSAnyKeyword extends BaseNode {
|
||||||
|
|||||||
@ -126,6 +126,7 @@ defineType("TSIndexSignature", {
|
|||||||
visitor: ["parameters", "typeAnnotation"],
|
visitor: ["parameters", "typeAnnotation"],
|
||||||
fields: {
|
fields: {
|
||||||
readonly: validateOptional(bool),
|
readonly: validateOptional(bool),
|
||||||
|
static: validateOptional(bool),
|
||||||
parameters: validateArrayOfType("Identifier"), // Length must be 1
|
parameters: validateArrayOfType("Identifier"), // Length must be 1
|
||||||
typeAnnotation: validateOptionalType("TSTypeAnnotation"),
|
typeAnnotation: validateOptionalType("TSTypeAnnotation"),
|
||||||
},
|
},
|
||||||
|
|||||||
@ -26,6 +26,8 @@ amdModuleName2.ts
|
|||||||
anonClassDeclarationEmitIsAnon.ts
|
anonClassDeclarationEmitIsAnon.ts
|
||||||
anyDeclare.ts
|
anyDeclare.ts
|
||||||
argumentsBindsToFunctionScopeArgumentList.ts
|
argumentsBindsToFunctionScopeArgumentList.ts
|
||||||
|
argumentsReferenceInConstructor4_Js.ts
|
||||||
|
argumentsReferenceInMethod4_Js.ts
|
||||||
arrayOfExportedClass.ts
|
arrayOfExportedClass.ts
|
||||||
asiAbstract.ts
|
asiAbstract.ts
|
||||||
asyncFunctionsAcrossFiles.ts
|
asyncFunctionsAcrossFiles.ts
|
||||||
@ -80,12 +82,15 @@ conflictingTypeAnnotatedVar.ts
|
|||||||
constDeclarations-invalidContexts.ts
|
constDeclarations-invalidContexts.ts
|
||||||
constDeclarations-scopes.ts
|
constDeclarations-scopes.ts
|
||||||
constDeclarations-validContexts.ts
|
constDeclarations-validContexts.ts
|
||||||
|
constEnumNamespaceReferenceCausesNoImport2.ts
|
||||||
constEnumNoEmitReexport.ts
|
constEnumNoEmitReexport.ts
|
||||||
constEnumNoPreserveDeclarationReexport.ts
|
constEnumNoPreserveDeclarationReexport.ts
|
||||||
constEnumPreserveEmitReexport.ts
|
constEnumPreserveEmitReexport.ts
|
||||||
|
contextualOverloadListFromArrayUnion.ts
|
||||||
controlFlowPrivateClassField.ts
|
controlFlowPrivateClassField.ts
|
||||||
convertKeywordsYes.ts
|
convertKeywordsYes.ts
|
||||||
declarationEmitAmdModuleNameDirective.ts
|
declarationEmitAmdModuleNameDirective.ts
|
||||||
|
declarationEmitCommonSourceDirectoryDoesNotContainAllFiles.ts
|
||||||
declarationEmitComputedNameCausesImportToBePainted.ts
|
declarationEmitComputedNameCausesImportToBePainted.ts
|
||||||
declarationEmitComputedNameConstEnumAlias.ts
|
declarationEmitComputedNameConstEnumAlias.ts
|
||||||
declarationEmitCrossFileImportTypeOfAmbientModule.ts
|
declarationEmitCrossFileImportTypeOfAmbientModule.ts
|
||||||
@ -99,12 +104,16 @@ declarationEmitExportAssignedNamespaceNoTripleSlashTypesReference.ts
|
|||||||
declarationEmitExportAssignment.ts
|
declarationEmitExportAssignment.ts
|
||||||
declarationEmitExportDeclaration.ts
|
declarationEmitExportDeclaration.ts
|
||||||
declarationEmitExpressionInExtends6.ts
|
declarationEmitExpressionInExtends6.ts
|
||||||
|
declarationEmitExpressionWithNonlocalPrivateUniqueSymbol.ts
|
||||||
declarationEmitForModuleImportingModuleAugmentationRetainsImport.ts
|
declarationEmitForModuleImportingModuleAugmentationRetainsImport.ts
|
||||||
declarationEmitForTypesWhichNeedImportTypes.ts
|
declarationEmitForTypesWhichNeedImportTypes.ts
|
||||||
declarationEmitInterfaceWithNonEntityNameExpressionHeritage.ts
|
declarationEmitInterfaceWithNonEntityNameExpressionHeritage.ts
|
||||||
|
declarationEmitMixinPrivateProtected.ts
|
||||||
declarationEmitPrefersPathKindBasedOnBundling.ts
|
declarationEmitPrefersPathKindBasedOnBundling.ts
|
||||||
declarationEmitPrefersPathKindBasedOnBundling2.ts
|
declarationEmitPrefersPathKindBasedOnBundling2.ts
|
||||||
declarationEmitPrivateSymbolCausesVarDeclarationEmit2.ts
|
declarationEmitPrivateSymbolCausesVarDeclarationEmit2.ts
|
||||||
|
declarationEmitReadonlyComputedProperty.ts
|
||||||
|
declarationEmitStringEnumUsedInNonlocalSpread.ts
|
||||||
declarationImportTypeAliasInferredAndEmittable.ts
|
declarationImportTypeAliasInferredAndEmittable.ts
|
||||||
declarationMapsMultifile.ts
|
declarationMapsMultifile.ts
|
||||||
declarationMapsOutFile.ts
|
declarationMapsOutFile.ts
|
||||||
@ -188,6 +197,7 @@ esModuleInterop.ts
|
|||||||
esModuleInteropImportTSLibHasImport.ts
|
esModuleInteropImportTSLibHasImport.ts
|
||||||
esModuleInteropNamedDefaultImports.ts
|
esModuleInteropNamedDefaultImports.ts
|
||||||
esModuleInteropTslibHelpers.ts
|
esModuleInteropTslibHelpers.ts
|
||||||
|
esNextWeakRefs_IterableWeakMap.ts
|
||||||
expandoFunctionContextualTypesNoValue.ts
|
expandoFunctionContextualTypesNoValue.ts
|
||||||
exportAssignClassAndModule.ts
|
exportAssignClassAndModule.ts
|
||||||
exportAssignmentImportMergeNoCrash.ts
|
exportAssignmentImportMergeNoCrash.ts
|
||||||
@ -227,7 +237,6 @@ gettersAndSettersErrors.ts
|
|||||||
giant.ts
|
giant.ts
|
||||||
globalThisDeclarationEmit.ts
|
globalThisDeclarationEmit.ts
|
||||||
globalThisDeclarationEmit2.ts
|
globalThisDeclarationEmit2.ts
|
||||||
hugeDeclarationOutputGetsTruncatedWithError.ts
|
|
||||||
implementClausePrecedingExtends.ts
|
implementClausePrecedingExtends.ts
|
||||||
implementsClauseAlreadySeen.ts
|
implementsClauseAlreadySeen.ts
|
||||||
importAndVariableDeclarationConflict1.ts
|
importAndVariableDeclarationConflict1.ts
|
||||||
@ -271,6 +280,8 @@ interfaceWithImplements1.ts
|
|||||||
invalidReferenceSyntax1.ts
|
invalidReferenceSyntax1.ts
|
||||||
isLiteral1.ts
|
isLiteral1.ts
|
||||||
isLiteral2.ts
|
isLiteral2.ts
|
||||||
|
isolatedModulesImportConstEnum.ts
|
||||||
|
isolatedModulesImportConstEnumTypeOnly.ts
|
||||||
isolatedModulesReExportType.ts
|
isolatedModulesReExportType.ts
|
||||||
jsEnumTagOnObjectFrozen.ts
|
jsEnumTagOnObjectFrozen.ts
|
||||||
jsExportMemberMergedWithModuleAugmentation.ts
|
jsExportMemberMergedWithModuleAugmentation.ts
|
||||||
@ -336,7 +347,8 @@ moduleAugmentationsImports2.ts
|
|||||||
moduleAugmentationsImports3.ts
|
moduleAugmentationsImports3.ts
|
||||||
moduleAugmentationsImports4.ts
|
moduleAugmentationsImports4.ts
|
||||||
moduleDuplicateIdentifiers.ts
|
moduleDuplicateIdentifiers.ts
|
||||||
moduleResolutionNoTs.ts
|
moduleResolutionNoTsCJS.ts
|
||||||
|
moduleResolutionNoTsESM.ts
|
||||||
moduleResolutionWithSymlinks.ts
|
moduleResolutionWithSymlinks.ts
|
||||||
moduleResolutionWithSymlinks_withOutDir.ts
|
moduleResolutionWithSymlinks_withOutDir.ts
|
||||||
moduleResolution_automaticTypeDirectiveNames.ts
|
moduleResolution_automaticTypeDirectiveNames.ts
|
||||||
@ -353,6 +365,7 @@ noBundledEmitFromNodeModules.ts
|
|||||||
noCrashOnImportShadowing.ts
|
noCrashOnImportShadowing.ts
|
||||||
noImplicitAnyDestructuringVarDeclaration.ts
|
noImplicitAnyDestructuringVarDeclaration.ts
|
||||||
noSymbolForMergeCrash.ts
|
noSymbolForMergeCrash.ts
|
||||||
|
nodeModuleReexportFromDottedPath.ts
|
||||||
nodeResolution4.ts
|
nodeResolution4.ts
|
||||||
nodeResolution6.ts
|
nodeResolution6.ts
|
||||||
nodeResolution8.ts
|
nodeResolution8.ts
|
||||||
@ -398,7 +411,8 @@ shorthandPropertyAssignmentInES6Module.ts
|
|||||||
sourceMap-LineBreaks.ts
|
sourceMap-LineBreaks.ts
|
||||||
sourceMapValidationDecorators.ts
|
sourceMapValidationDecorators.ts
|
||||||
sourceMapValidationStatements.ts
|
sourceMapValidationStatements.ts
|
||||||
staticIndexer.ts
|
staticAsIdentifier.ts
|
||||||
|
staticModifierAlreadySeen.ts
|
||||||
strictModeReservedWord.ts
|
strictModeReservedWord.ts
|
||||||
superCallFromClassThatHasNoBaseType1.ts
|
superCallFromClassThatHasNoBaseType1.ts
|
||||||
symbolLinkDeclarationEmitModuleNames.ts
|
symbolLinkDeclarationEmitModuleNames.ts
|
||||||
@ -422,6 +436,7 @@ typeReferenceDirectives7.ts
|
|||||||
typeReferenceDirectives8.ts
|
typeReferenceDirectives8.ts
|
||||||
typeReferenceDirectives9.ts
|
typeReferenceDirectives9.ts
|
||||||
uniqueSymbolPropertyDeclarationEmit.ts
|
uniqueSymbolPropertyDeclarationEmit.ts
|
||||||
|
unusedImportWithSpread.ts
|
||||||
unusedImports1.ts
|
unusedImports1.ts
|
||||||
unusedImports11.ts
|
unusedImports11.ts
|
||||||
unusedImports12.ts
|
unusedImports12.ts
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user