@swc/core 1.2.212 → 1.2.213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/Visitor.d.ts +17 -4
- package/Visitor.js +96 -9
- package/package.json +14 -14
- package/types.d.ts +163 -95
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,47 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(css/codegen)** Fix sourcemap of multibyte characters (#5183) ([5b70233](https://github.com/swc-project/swc/commit/5b70233400a5b67cf51650bebbd59dcd0699ba78))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(css/parser)** Avoid skipping whitespaces if not required (#5181) ([7b28521](https://github.com/swc-project/swc/commit/7b28521d72776a33f5d51c8ac9fdc674268fa418))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/minifier)** Don't merge exported declarations (#5193) ([16ece4d](https://github.com/swc-project/swc/commit/16ece4dce0acdbb0e368b085dc1fcbeec3017789))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(html/codegen)** Fix source map generation (#5184) ([60ca553](https://github.com/swc-project/swc/commit/60ca5538f9c658a5f9bb7b9dd83d1795ed18bde3))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- **(node/types)** Fix AST type definitions (#5175) ([afd5171](https://github.com/swc-project/swc/commit/afd5171240835c6c2dbd5e06584409796ba08501))
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- **(es/codegen)** Emit comments in `emit_module` (#5132) ([1ef541e](https://github.com/swc-project/swc/commit/1ef541eec4a98dc23bef706f881fac9dddd196ca))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
- **(html/minifier)** Allow specifying options for other tools (#5125) ([dada2d7](https://github.com/swc-project/swc/commit/dada2d7d554fa0733a3c65c512777f1548d41a35))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- **(visit)** Improve API (#5185) ([4744d43](https://github.com/swc-project/swc/commit/4744d438a9cf44d59dc899ea054ae5e65f6490c8))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- **(visit)** Implement serde for `AstParentKind` (#5191) ([d1418ee](https://github.com/swc-project/swc/commit/d1418ee977428597b3f9833b8cee6ca434186ae4))
|
|
36
|
+
|
|
37
|
+
### Testing
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
- **(node)** Refactor tests (#5187) ([a4b14c3](https://github.com/swc-project/swc/commit/a4b14c38065cba3a244118c3eaf74e8ebb0d938d))
|
|
42
|
+
|
|
43
|
+
## [1.2.212] - 2022-07-11
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
8
49
|
- **(es/modules)** Add the missing span for `export default` (#5170) ([997240c](https://github.com/swc-project/swc/commit/997240cfe68ff7787d73e93758f2d2304715e249))
|
|
9
50
|
|
|
10
51
|
|
package/Visitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessibility, ArrayExpression, ArrayPattern, ArrowFunctionExpression, Argument, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingExpression, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StringLiteral, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsImportEqualsDeclaration, TsIndexSignature, TsInterfaceBody, TsInterfaceDeclaration, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsQualifiedName, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression, Param, ExprOrSpread, TsConstAssertion, Import, SuperPropExpression } from "./types";
|
|
1
|
+
import { Accessibility, ArrayExpression, ArrayPattern, ArrowFunctionExpression, Argument, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleExportName, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingCall, OptionalChainingExpression, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StaticBlock, StringLiteral, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsCallSignatureDeclaration, TsConstructSignatureDeclaration, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsGetterSignature, TsImportEqualsDeclaration, TsIndexSignature, TsInstantiation, TsInterfaceBody, TsInterfaceDeclaration, TsMethodSignature, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsPropertySignature, TsQualifiedName, TsSetterSignature, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression, Param, ExprOrSpread, TsConstAssertion, Import, SuperPropExpression } from "./types";
|
|
2
2
|
export declare class Visitor {
|
|
3
3
|
visitProgram(n: Program): Program;
|
|
4
4
|
visitModule(m: Module): Module;
|
|
@@ -17,6 +17,7 @@ export declare class Visitor {
|
|
|
17
17
|
visitExportSpecifiers(nodes: ExportSpecifier[]): ExportSpecifier[];
|
|
18
18
|
visitExportSpecifier(n: ExportSpecifier): ExportSpecifier;
|
|
19
19
|
visitNamedExportSpecifier(n: NamedExportSpecifier): ExportSpecifier;
|
|
20
|
+
visitModuleExportName(n: ModuleExportName): ModuleExportName;
|
|
20
21
|
visitExportNamespaceSpecifier(n: ExportNamespaceSpecifier): ExportSpecifier;
|
|
21
22
|
visitExportDefaultSpecifier(n: ExportDefaultSpecifier): ExportSpecifier;
|
|
22
23
|
visitOptionalStringLiteral(n: StringLiteral | undefined): StringLiteral | undefined;
|
|
@@ -28,6 +29,7 @@ export declare class Visitor {
|
|
|
28
29
|
visitArrayExpression(e: ArrayExpression): Expression;
|
|
29
30
|
visitArrayElement(e: ExprOrSpread | undefined): ExprOrSpread | undefined;
|
|
30
31
|
visitExprOrSpread(e: ExprOrSpread): ExprOrSpread;
|
|
32
|
+
visitExprOrSpreads(nodes: ExprOrSpread[]): ExprOrSpread[];
|
|
31
33
|
visitSpreadElement(e: SpreadElement): SpreadElement;
|
|
32
34
|
visitOptionalExpression(e: Expression | undefined): Expression | undefined;
|
|
33
35
|
visitArrowFunctionExpression(e: ArrowFunctionExpression): Expression;
|
|
@@ -50,7 +52,7 @@ export declare class Visitor {
|
|
|
50
52
|
visitForStatement(stmt: ForStatement): Statement;
|
|
51
53
|
visitForOfStatement(stmt: ForOfStatement): Statement;
|
|
52
54
|
visitForInStatement(stmt: ForInStatement): Statement;
|
|
53
|
-
visitEmptyStatement(stmt: EmptyStatement):
|
|
55
|
+
visitEmptyStatement(stmt: EmptyStatement): EmptyStatement;
|
|
54
56
|
visitDoWhileStatement(stmt: DoWhileStatement): Statement;
|
|
55
57
|
visitDebuggerStatement(stmt: DebuggerStatement): Statement;
|
|
56
58
|
visitWithStatement(stmt: WithStatement): Statement;
|
|
@@ -68,6 +70,12 @@ export declare class Visitor {
|
|
|
68
70
|
visitTsInterfaceBody(n: TsInterfaceBody): TsInterfaceBody;
|
|
69
71
|
visitTsTypeElements(nodes: TsTypeElement[]): TsTypeElement[];
|
|
70
72
|
visitTsTypeElement(n: TsTypeElement): TsTypeElement;
|
|
73
|
+
visitTsCallSignatureDeclaration(n: TsCallSignatureDeclaration): TsCallSignatureDeclaration;
|
|
74
|
+
visitTsConstructSignatureDeclaration(n: TsConstructSignatureDeclaration): TsConstructSignatureDeclaration;
|
|
75
|
+
visitTsPropertySignature(n: TsPropertySignature): TsPropertySignature;
|
|
76
|
+
visitTsGetterSignature(n: TsGetterSignature): TsGetterSignature;
|
|
77
|
+
visitTsSetterSignature(n: TsSetterSignature): TsSetterSignature;
|
|
78
|
+
visitTsMethodSignature(n: TsMethodSignature): TsMethodSignature;
|
|
71
79
|
visitTsEnumDeclaration(n: TsEnumDeclaration): Declaration;
|
|
72
80
|
visitTsEnumMembers(nodes: TsEnumMember[]): TsEnumMember[];
|
|
73
81
|
visitTsEnumMember(n: TsEnumMember): TsEnumMember;
|
|
@@ -76,7 +84,7 @@ export declare class Visitor {
|
|
|
76
84
|
visitClassDeclaration(decl: ClassDeclaration): Declaration;
|
|
77
85
|
visitClassBody(members: ClassMember[]): ClassMember[];
|
|
78
86
|
visitClassMember(member: ClassMember): ClassMember;
|
|
79
|
-
visitTsIndexSignature(n: TsIndexSignature):
|
|
87
|
+
visitTsIndexSignature(n: TsIndexSignature): TsIndexSignature;
|
|
80
88
|
visitTsFnParameters(params: TsFnParameter[]): TsFnParameter[];
|
|
81
89
|
visitTsFnParameter(n: TsFnParameter): TsFnParameter;
|
|
82
90
|
visitPrivateProperty(n: PrivateProperty): ClassMember;
|
|
@@ -85,6 +93,7 @@ export declare class Visitor {
|
|
|
85
93
|
visitConstructor(n: Constructor): ClassMember;
|
|
86
94
|
visitConstructorParameters(nodes: (Param | TsParameterProperty)[]): (Param | TsParameterProperty)[];
|
|
87
95
|
visitConstructorParameter(n: Param | TsParameterProperty): Param | TsParameterProperty;
|
|
96
|
+
visitStaticBlock(n: StaticBlock): StaticBlock;
|
|
88
97
|
visitTsParameterProperty(n: TsParameterProperty): TsParameterProperty | Param;
|
|
89
98
|
visitTsParameterPropertyParameter(n: TsParameterPropertyParameter): TsParameterPropertyParameter;
|
|
90
99
|
visitPropertyName(key: PropertyName): PropertyName;
|
|
@@ -106,6 +115,8 @@ export declare class Visitor {
|
|
|
106
115
|
visitContinueStatement(stmt: ContinueStatement): Statement;
|
|
107
116
|
visitExpression(n: Expression): Expression;
|
|
108
117
|
visitOptionalChainingExpression(n: OptionalChainingExpression): Expression;
|
|
118
|
+
visitMemberExpressionOrOptionalChainingCall(n: MemberExpression | OptionalChainingCall): MemberExpression | OptionalChainingCall;
|
|
119
|
+
visitOptionalChainingCall(n: OptionalChainingCall): OptionalChainingCall;
|
|
109
120
|
visitAssignmentExpression(n: AssignmentExpression): Expression;
|
|
110
121
|
visitPatternOrExpression(n: Pattern | Expression): Pattern | Expression;
|
|
111
122
|
visitYieldExpression(n: YieldExpression): Expression;
|
|
@@ -113,6 +124,7 @@ export declare class Visitor {
|
|
|
113
124
|
visitUnaryExpression(n: UnaryExpression): Expression;
|
|
114
125
|
visitTsTypeAssertion(n: TsTypeAssertion): Expression;
|
|
115
126
|
visitTsConstAssertion(n: TsConstAssertion): Expression;
|
|
127
|
+
visitTsInstantiation(n: TsInstantiation): TsInstantiation;
|
|
116
128
|
visitTsNonNullExpression(n: TsNonNullExpression): Expression;
|
|
117
129
|
visitTsAsExpression(n: TsAsExpression): Expression;
|
|
118
130
|
visitThisExpression(n: ThisExpression): Expression;
|
|
@@ -138,7 +150,7 @@ export declare class Visitor {
|
|
|
138
150
|
visitArguments(nodes: Argument[]): Argument[];
|
|
139
151
|
visitArgument(n: Argument): Argument;
|
|
140
152
|
visitMetaProperty(n: MetaProperty): Expression;
|
|
141
|
-
visitMemberExpression(n: MemberExpression):
|
|
153
|
+
visitMemberExpression(n: MemberExpression): MemberExpression;
|
|
142
154
|
visitSuperPropExpression(n: SuperPropExpression): Expression;
|
|
143
155
|
visitCallee(n: Expression | Super | Import): Expression | Super | Import;
|
|
144
156
|
visitJSXText(n: JSXText): JSXText;
|
|
@@ -159,6 +171,7 @@ export declare class Visitor {
|
|
|
159
171
|
visitJSXOpeningElement(n: JSXOpeningElement): JSXOpeningElement;
|
|
160
172
|
visitJSXAttributes(attrs: JSXAttributeOrSpread[] | undefined): JSXAttributeOrSpread[] | undefined;
|
|
161
173
|
visitJSXAttributeOrSpread(n: JSXAttributeOrSpread): JSXAttributeOrSpread;
|
|
174
|
+
visitJSXAttributeOrSpreads(nodes: JSXAttributeOrSpread[]): JSXAttributeOrSpread[];
|
|
162
175
|
visitJSXAttribute(n: JSXAttribute): JSXAttributeOrSpread;
|
|
163
176
|
visitJSXAttributeValue(n: JSXAttrValue | undefined): JSXAttrValue | undefined;
|
|
164
177
|
visitJSXAttributeName(n: JSXAttributeName): JSXAttributeName;
|
package/Visitor.js
CHANGED
|
@@ -83,7 +83,7 @@ class Visitor {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
visitTsExternalModuleReference(n) {
|
|
86
|
-
n.expression = this.
|
|
86
|
+
n.expression = this.visitStringLiteral(n.expression);
|
|
87
87
|
return n;
|
|
88
88
|
}
|
|
89
89
|
visitExportAllDeclaration(n) {
|
|
@@ -114,13 +114,21 @@ class Visitor {
|
|
|
114
114
|
}
|
|
115
115
|
visitNamedExportSpecifier(n) {
|
|
116
116
|
if (n.exported) {
|
|
117
|
-
n.exported = this.
|
|
117
|
+
n.exported = this.visitModuleExportName(n.exported);
|
|
118
118
|
}
|
|
119
|
-
n.orig = this.
|
|
119
|
+
n.orig = this.visitModuleExportName(n.orig);
|
|
120
120
|
return n;
|
|
121
121
|
}
|
|
122
|
+
visitModuleExportName(n) {
|
|
123
|
+
switch (n.type) {
|
|
124
|
+
case "Identifier":
|
|
125
|
+
return this.visitIdentifier(n);
|
|
126
|
+
case "StringLiteral":
|
|
127
|
+
return this.visitStringLiteral(n);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
122
130
|
visitExportNamespaceSpecifier(n) {
|
|
123
|
-
n.name = this.
|
|
131
|
+
n.name = this.visitModuleExportName(n.name);
|
|
124
132
|
return n;
|
|
125
133
|
}
|
|
126
134
|
visitExportDefaultSpecifier(n) {
|
|
@@ -178,6 +186,9 @@ class Visitor {
|
|
|
178
186
|
visitExprOrSpread(e) {
|
|
179
187
|
return Object.assign(Object.assign({}, e), { expression: this.visitExpression(e.expression) });
|
|
180
188
|
}
|
|
189
|
+
visitExprOrSpreads(nodes) {
|
|
190
|
+
return nodes.map(this.visitExprOrSpread.bind(this));
|
|
191
|
+
}
|
|
181
192
|
visitSpreadElement(e) {
|
|
182
193
|
e.arguments = this.visitExpression(e.arguments);
|
|
183
194
|
return e;
|
|
@@ -466,10 +477,51 @@ class Visitor {
|
|
|
466
477
|
return nodes.map(this.visitTsTypeElement.bind(this));
|
|
467
478
|
}
|
|
468
479
|
visitTsTypeElement(n) {
|
|
480
|
+
switch (n.type) {
|
|
481
|
+
case "TsCallSignatureDeclaration":
|
|
482
|
+
return this.visitTsCallSignatureDeclaration(n);
|
|
483
|
+
case "TsConstructSignatureDeclaration":
|
|
484
|
+
return this.visitTsConstructSignatureDeclaration(n);
|
|
485
|
+
case "TsPropertySignature":
|
|
486
|
+
return this.visitTsPropertySignature(n);
|
|
487
|
+
case "TsGetterSignature":
|
|
488
|
+
return this.visitTsGetterSignature(n);
|
|
489
|
+
case "TsSetterSignature":
|
|
490
|
+
return this.visitTsSetterSignature(n);
|
|
491
|
+
case "TsMethodSignature":
|
|
492
|
+
return this.visitTsMethodSignature(n);
|
|
493
|
+
case "TsIndexSignature":
|
|
494
|
+
return this.visitTsIndexSignature(n);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
visitTsCallSignatureDeclaration(n) {
|
|
498
|
+
n.params = this.visitTsFnParameters(n.params);
|
|
499
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
500
|
+
return n;
|
|
501
|
+
}
|
|
502
|
+
visitTsConstructSignatureDeclaration(n) {
|
|
503
|
+
n.params = this.visitTsFnParameters(n.params);
|
|
504
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
505
|
+
return n;
|
|
506
|
+
}
|
|
507
|
+
visitTsPropertySignature(n) {
|
|
469
508
|
n.params = this.visitTsFnParameters(n.params);
|
|
470
509
|
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
471
510
|
return n;
|
|
472
511
|
}
|
|
512
|
+
visitTsGetterSignature(n) {
|
|
513
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
514
|
+
return n;
|
|
515
|
+
}
|
|
516
|
+
visitTsSetterSignature(n) {
|
|
517
|
+
n.param = this.visitTsFnParameter(n.param);
|
|
518
|
+
return n;
|
|
519
|
+
}
|
|
520
|
+
visitTsMethodSignature(n) {
|
|
521
|
+
n.params = this.visitTsFnParameters(n.params);
|
|
522
|
+
n.typeAnn = this.visitTsTypeAnnotation(n.typeAnn);
|
|
523
|
+
return n;
|
|
524
|
+
}
|
|
473
525
|
visitTsEnumDeclaration(n) {
|
|
474
526
|
n.id = this.visitIdentifier(n.id);
|
|
475
527
|
n.members = this.visitTsEnumMembers(n.members);
|
|
@@ -518,11 +570,16 @@ class Visitor {
|
|
|
518
570
|
return this.visitPrivateProperty(member);
|
|
519
571
|
case "TsIndexSignature":
|
|
520
572
|
return this.visitTsIndexSignature(member);
|
|
573
|
+
case "EmptyStatement":
|
|
574
|
+
return this.visitEmptyStatement(member);
|
|
575
|
+
case "StaticBlock":
|
|
576
|
+
return this.visitStaticBlock(member);
|
|
521
577
|
}
|
|
522
578
|
}
|
|
523
579
|
visitTsIndexSignature(n) {
|
|
524
580
|
n.params = this.visitTsFnParameters(n.params);
|
|
525
|
-
|
|
581
|
+
if (n.typeAnnotation)
|
|
582
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
526
583
|
return n;
|
|
527
584
|
}
|
|
528
585
|
visitTsFnParameters(params) {
|
|
@@ -568,6 +625,10 @@ class Visitor {
|
|
|
568
625
|
return this.visitParameter(n);
|
|
569
626
|
}
|
|
570
627
|
}
|
|
628
|
+
visitStaticBlock(n) {
|
|
629
|
+
n.body = this.visitBlockStatement(n.body);
|
|
630
|
+
return n;
|
|
631
|
+
}
|
|
571
632
|
visitTsParameterProperty(n) {
|
|
572
633
|
n.accessibility = this.visitAccessibility(n.accessibility);
|
|
573
634
|
n.decorators = this.visitDecorators(n.decorators);
|
|
@@ -637,7 +698,7 @@ class Visitor {
|
|
|
637
698
|
return nodes.map(this.visitTsExpressionWithTypeArguments.bind(this));
|
|
638
699
|
}
|
|
639
700
|
visitTsExpressionWithTypeArguments(n) {
|
|
640
|
-
n.expression = this.
|
|
701
|
+
n.expression = this.visitExpression(n.expression);
|
|
641
702
|
n.typeArguments = this.visitTsTypeParameterInstantiation(n.typeArguments);
|
|
642
703
|
return n;
|
|
643
704
|
}
|
|
@@ -692,6 +753,8 @@ class Visitor {
|
|
|
692
753
|
return this.visitAssignmentExpression(n);
|
|
693
754
|
case "AwaitExpression":
|
|
694
755
|
return this.visitAwaitExpression(n);
|
|
756
|
+
case "BigIntLiteral":
|
|
757
|
+
return this.visitBigIntLiteral(n);
|
|
695
758
|
case "BinaryExpression":
|
|
696
759
|
return this.visitBinaryExpression(n);
|
|
697
760
|
case "BooleanLiteral":
|
|
@@ -756,6 +819,8 @@ class Visitor {
|
|
|
756
819
|
return this.visitTsTypeAssertion(n);
|
|
757
820
|
case "TsConstAssertion":
|
|
758
821
|
return this.visitTsConstAssertion(n);
|
|
822
|
+
case "TsInstantiation":
|
|
823
|
+
return this.visitTsInstantiation(n);
|
|
759
824
|
case "UnaryExpression":
|
|
760
825
|
return this.visitUnaryExpression(n);
|
|
761
826
|
case "UpdateExpression":
|
|
@@ -769,7 +834,22 @@ class Visitor {
|
|
|
769
834
|
}
|
|
770
835
|
}
|
|
771
836
|
visitOptionalChainingExpression(n) {
|
|
772
|
-
n.base = this.
|
|
837
|
+
n.base = this.visitMemberExpressionOrOptionalChainingCall(n.base);
|
|
838
|
+
return n;
|
|
839
|
+
}
|
|
840
|
+
visitMemberExpressionOrOptionalChainingCall(n) {
|
|
841
|
+
switch (n.type) {
|
|
842
|
+
case "MemberExpression":
|
|
843
|
+
return this.visitMemberExpression(n);
|
|
844
|
+
case "CallExpression":
|
|
845
|
+
return this.visitOptionalChainingCall(n);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
visitOptionalChainingCall(n) {
|
|
849
|
+
n.callee = this.visitExpression(n.callee);
|
|
850
|
+
n.arguments = this.visitExprOrSpreads(n.arguments);
|
|
851
|
+
if (n.typeArguments)
|
|
852
|
+
n.typeArguments = this.visitTsTypeParameterInstantiation(n.typeArguments);
|
|
773
853
|
return n;
|
|
774
854
|
}
|
|
775
855
|
visitAssignmentExpression(n) {
|
|
@@ -810,6 +890,10 @@ class Visitor {
|
|
|
810
890
|
n.expression = this.visitExpression(n.expression);
|
|
811
891
|
return n;
|
|
812
892
|
}
|
|
893
|
+
visitTsInstantiation(n) {
|
|
894
|
+
n.expression = this.visitExpression(n.expression);
|
|
895
|
+
return n;
|
|
896
|
+
}
|
|
813
897
|
visitTsNonNullExpression(n) {
|
|
814
898
|
n.expression = this.visitExpression(n.expression);
|
|
815
899
|
return n;
|
|
@@ -1072,7 +1156,7 @@ class Visitor {
|
|
|
1072
1156
|
visitJSXOpeningElement(n) {
|
|
1073
1157
|
n.name = this.visitJSXElementName(n.name);
|
|
1074
1158
|
n.typeArguments = this.visitTsTypeParameterInstantiation(n.typeArguments);
|
|
1075
|
-
n.attributes = this.
|
|
1159
|
+
n.attributes = this.visitJSXAttributeOrSpreads(n.attributes);
|
|
1076
1160
|
return n;
|
|
1077
1161
|
}
|
|
1078
1162
|
visitJSXAttributes(attrs) {
|
|
@@ -1087,6 +1171,9 @@ class Visitor {
|
|
|
1087
1171
|
return this.visitSpreadElement(n);
|
|
1088
1172
|
}
|
|
1089
1173
|
}
|
|
1174
|
+
visitJSXAttributeOrSpreads(nodes) {
|
|
1175
|
+
return nodes.map(this.visitJSXAttributeOrSpread.bind(this));
|
|
1176
|
+
}
|
|
1090
1177
|
visitJSXAttribute(n) {
|
|
1091
1178
|
n.name = this.visitJSXAttributeName(n.name);
|
|
1092
1179
|
n.value = this.visitJSXAttributeValue(n.value);
|
|
@@ -1201,7 +1288,7 @@ class Visitor {
|
|
|
1201
1288
|
visitNamedImportSpecifier(node) {
|
|
1202
1289
|
node.local = this.visitBindingIdentifier(node.local);
|
|
1203
1290
|
if (node.imported) {
|
|
1204
|
-
node.imported = this.
|
|
1291
|
+
node.imported = this.visitModuleExportName(node.imported);
|
|
1205
1292
|
}
|
|
1206
1293
|
return node;
|
|
1207
1294
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.213",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -135,18 +135,18 @@
|
|
|
135
135
|
"url": "https://opencollective.com/swc"
|
|
136
136
|
},
|
|
137
137
|
"optionalDependencies": {
|
|
138
|
-
"@swc/core-win32-x64-msvc": "1.2.
|
|
139
|
-
"@swc/core-darwin-x64": "1.2.
|
|
140
|
-
"@swc/core-linux-x64-gnu": "1.2.
|
|
141
|
-
"@swc/core-linux-x64-musl": "1.2.
|
|
142
|
-
"@swc/core-freebsd-x64": "1.2.
|
|
143
|
-
"@swc/core-win32-ia32-msvc": "1.2.
|
|
144
|
-
"@swc/core-linux-arm64-gnu": "1.2.
|
|
145
|
-
"@swc/core-linux-arm-gnueabihf": "1.2.
|
|
146
|
-
"@swc/core-darwin-arm64": "1.2.
|
|
147
|
-
"@swc/core-android-arm64": "1.2.
|
|
148
|
-
"@swc/core-linux-arm64-musl": "1.2.
|
|
149
|
-
"@swc/core-win32-arm64-msvc": "1.2.
|
|
150
|
-
"@swc/core-android-arm-eabi": "1.2.
|
|
138
|
+
"@swc/core-win32-x64-msvc": "1.2.213",
|
|
139
|
+
"@swc/core-darwin-x64": "1.2.213",
|
|
140
|
+
"@swc/core-linux-x64-gnu": "1.2.213",
|
|
141
|
+
"@swc/core-linux-x64-musl": "1.2.213",
|
|
142
|
+
"@swc/core-freebsd-x64": "1.2.213",
|
|
143
|
+
"@swc/core-win32-ia32-msvc": "1.2.213",
|
|
144
|
+
"@swc/core-linux-arm64-gnu": "1.2.213",
|
|
145
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.213",
|
|
146
|
+
"@swc/core-darwin-arm64": "1.2.213",
|
|
147
|
+
"@swc/core-android-arm64": "1.2.213",
|
|
148
|
+
"@swc/core-linux-arm64-musl": "1.2.213",
|
|
149
|
+
"@swc/core-win32-arm64-msvc": "1.2.213",
|
|
150
|
+
"@swc/core-android-arm-eabi": "1.2.213"
|
|
151
151
|
}
|
|
152
152
|
}
|
package/types.d.ts
CHANGED
|
@@ -874,29 +874,31 @@ export interface HasDecorator {
|
|
|
874
874
|
export interface Class extends HasSpan, HasDecorator {
|
|
875
875
|
body: ClassMember[];
|
|
876
876
|
superClass?: Expression;
|
|
877
|
-
|
|
878
|
-
typeParams
|
|
877
|
+
isAbstract: boolean;
|
|
878
|
+
typeParams?: TsTypeParameterDeclaration;
|
|
879
879
|
superTypeParams?: TsTypeParameterInstantiation;
|
|
880
880
|
implements: TsExpressionWithTypeArguments[];
|
|
881
881
|
}
|
|
882
|
-
export declare type ClassMember = Constructor | ClassMethod | PrivateMethod | ClassProperty | PrivateProperty | TsIndexSignature;
|
|
882
|
+
export declare type ClassMember = Constructor | ClassMethod | PrivateMethod | ClassProperty | PrivateProperty | TsIndexSignature | EmptyStatement | StaticBlock;
|
|
883
883
|
export interface ClassPropertyBase extends Node, HasSpan, HasDecorator {
|
|
884
884
|
value?: Expression;
|
|
885
885
|
typeAnnotation?: TsTypeAnnotation;
|
|
886
|
-
|
|
886
|
+
isStatic: boolean;
|
|
887
887
|
accessibility?: Accessibility;
|
|
888
|
-
|
|
888
|
+
isOptional: boolean;
|
|
889
|
+
isOverride: boolean;
|
|
889
890
|
readonly: boolean;
|
|
891
|
+
definite: boolean;
|
|
890
892
|
}
|
|
891
893
|
export interface ClassProperty extends ClassPropertyBase {
|
|
892
894
|
type: "ClassProperty";
|
|
893
895
|
key: PropertyName;
|
|
896
|
+
isAbstract: boolean;
|
|
897
|
+
declare: boolean;
|
|
894
898
|
}
|
|
895
899
|
export interface PrivateProperty extends ClassPropertyBase {
|
|
896
900
|
type: "PrivateProperty";
|
|
897
901
|
key: PrivateName;
|
|
898
|
-
is_abstract: boolean;
|
|
899
|
-
definite: boolean;
|
|
900
902
|
}
|
|
901
903
|
export interface Param extends Node, HasSpan, HasDecorator {
|
|
902
904
|
type: "Parameter";
|
|
@@ -905,18 +907,19 @@ export interface Param extends Node, HasSpan, HasDecorator {
|
|
|
905
907
|
export interface Constructor extends Node, HasSpan {
|
|
906
908
|
type: "Constructor";
|
|
907
909
|
key: PropertyName;
|
|
908
|
-
params: (
|
|
909
|
-
body
|
|
910
|
+
params: (TsParameterProperty | Param)[];
|
|
911
|
+
body?: BlockStatement;
|
|
910
912
|
accessibility?: Accessibility;
|
|
911
|
-
|
|
913
|
+
isOptional: boolean;
|
|
912
914
|
}
|
|
913
915
|
export interface ClassMethodBase extends Node, HasSpan {
|
|
914
916
|
function: Fn;
|
|
915
917
|
kind: MethodKind;
|
|
916
|
-
|
|
918
|
+
isStatic: boolean;
|
|
917
919
|
accessibility?: Accessibility;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
+
isAbstract: boolean;
|
|
921
|
+
isOptional: boolean;
|
|
922
|
+
isOverride: boolean;
|
|
920
923
|
}
|
|
921
924
|
export interface ClassMethod extends ClassMethodBase {
|
|
922
925
|
type: "ClassMethod";
|
|
@@ -926,11 +929,15 @@ export interface PrivateMethod extends ClassMethodBase {
|
|
|
926
929
|
type: "PrivateMethod";
|
|
927
930
|
key: PrivateName;
|
|
928
931
|
}
|
|
932
|
+
export interface StaticBlock extends Node, HasSpan {
|
|
933
|
+
type: "StaticBlock";
|
|
934
|
+
body: BlockStatement;
|
|
935
|
+
}
|
|
929
936
|
export interface Decorator extends Node, HasSpan {
|
|
930
937
|
type: "Decorator";
|
|
931
938
|
expression: Expression;
|
|
932
939
|
}
|
|
933
|
-
export declare type MethodKind = "method" | "
|
|
940
|
+
export declare type MethodKind = "method" | "getter" | "setter";
|
|
934
941
|
export declare type Declaration = ClassDeclaration | FunctionDeclaration | VariableDeclaration | TsInterfaceDeclaration | TsTypeAliasDeclaration | TsEnumDeclaration | TsModuleDeclaration;
|
|
935
942
|
export interface FunctionDeclaration extends Fn {
|
|
936
943
|
type: "FunctionDeclaration";
|
|
@@ -955,15 +962,27 @@ export interface VariableDeclarator extends Node, HasSpan {
|
|
|
955
962
|
init?: Expression;
|
|
956
963
|
definite: boolean;
|
|
957
964
|
}
|
|
958
|
-
export declare type Expression = ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | MemberExpression | SuperPropExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier | Literal | TemplateLiteral | TaggedTemplateExpression | ArrowFunctionExpression | ClassExpression | YieldExpression | MetaProperty | AwaitExpression | ParenthesisExpression | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXElement | JSXFragment | TsTypeAssertion | TsConstAssertion | TsNonNullExpression | TsAsExpression | PrivateName | OptionalChainingExpression | Invalid;
|
|
965
|
+
export declare type Expression = ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | MemberExpression | SuperPropExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier | Literal | TemplateLiteral | TaggedTemplateExpression | ArrowFunctionExpression | ClassExpression | YieldExpression | MetaProperty | AwaitExpression | ParenthesisExpression | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXElement | JSXFragment | TsTypeAssertion | TsConstAssertion | TsNonNullExpression | TsAsExpression | TsInstantiation | PrivateName | OptionalChainingExpression | Invalid;
|
|
959
966
|
interface ExpressionBase extends Node, HasSpan {
|
|
960
967
|
}
|
|
968
|
+
export interface Identifier extends ExpressionBase {
|
|
969
|
+
type: "Identifier";
|
|
970
|
+
value: string;
|
|
971
|
+
optional: boolean;
|
|
972
|
+
}
|
|
961
973
|
export interface OptionalChainingExpression extends ExpressionBase {
|
|
962
974
|
type: "OptionalChainingExpression";
|
|
975
|
+
questionDotToken: Span;
|
|
963
976
|
/**
|
|
964
977
|
* Call expression or member expression.
|
|
965
978
|
*/
|
|
966
|
-
base:
|
|
979
|
+
base: MemberExpression | OptionalChainingCall;
|
|
980
|
+
}
|
|
981
|
+
export interface OptionalChainingCall extends ExpressionBase {
|
|
982
|
+
type: "CallExpression";
|
|
983
|
+
callee: Expression;
|
|
984
|
+
arguments: ExprOrSpread[];
|
|
985
|
+
typeArguments?: TsTypeParameterInstantiation;
|
|
967
986
|
}
|
|
968
987
|
export interface ThisExpression extends ExpressionBase {
|
|
969
988
|
type: "ThisExpression";
|
|
@@ -978,13 +997,12 @@ export interface ExprOrSpread {
|
|
|
978
997
|
}
|
|
979
998
|
export interface ObjectExpression extends ExpressionBase {
|
|
980
999
|
type: "ObjectExpression";
|
|
981
|
-
properties: (
|
|
1000
|
+
properties: (SpreadElement | Property)[];
|
|
982
1001
|
}
|
|
983
1002
|
export interface Argument {
|
|
984
1003
|
spread?: Span;
|
|
985
1004
|
expression: Expression;
|
|
986
1005
|
}
|
|
987
|
-
export declare type PropertOrSpread = Property | SpreadElement;
|
|
988
1006
|
export interface SpreadElement extends Node {
|
|
989
1007
|
type: "SpreadElement";
|
|
990
1008
|
spread: Span;
|
|
@@ -1009,16 +1027,16 @@ export interface BinaryExpression extends ExpressionBase {
|
|
|
1009
1027
|
}
|
|
1010
1028
|
export interface FunctionExpression extends Fn, ExpressionBase {
|
|
1011
1029
|
type: "FunctionExpression";
|
|
1012
|
-
identifier
|
|
1030
|
+
identifier?: Identifier;
|
|
1013
1031
|
}
|
|
1014
1032
|
export interface ClassExpression extends Class, ExpressionBase {
|
|
1015
1033
|
type: "ClassExpression";
|
|
1016
|
-
identifier
|
|
1034
|
+
identifier?: Identifier;
|
|
1017
1035
|
}
|
|
1018
1036
|
export interface AssignmentExpression extends ExpressionBase {
|
|
1019
1037
|
type: "AssignmentExpression";
|
|
1020
1038
|
operator: AssignmentOperator;
|
|
1021
|
-
left:
|
|
1039
|
+
left: Expression | Pattern;
|
|
1022
1040
|
right: Expression;
|
|
1023
1041
|
}
|
|
1024
1042
|
export interface MemberExpression extends ExpressionBase {
|
|
@@ -1028,7 +1046,7 @@ export interface MemberExpression extends ExpressionBase {
|
|
|
1028
1046
|
}
|
|
1029
1047
|
export interface SuperPropExpression extends ExpressionBase {
|
|
1030
1048
|
type: "SuperPropExpression";
|
|
1031
|
-
|
|
1049
|
+
obj: Super;
|
|
1032
1050
|
property: Identifier | ComputedPropName;
|
|
1033
1051
|
}
|
|
1034
1052
|
export interface ConditionalExpression extends ExpressionBase {
|
|
@@ -1045,14 +1063,14 @@ export interface Import extends Node, HasSpan {
|
|
|
1045
1063
|
}
|
|
1046
1064
|
export interface CallExpression extends ExpressionBase {
|
|
1047
1065
|
type: "CallExpression";
|
|
1048
|
-
callee:
|
|
1066
|
+
callee: Super | Import | Expression;
|
|
1049
1067
|
arguments: Argument[];
|
|
1050
1068
|
typeArguments?: TsTypeParameterInstantiation;
|
|
1051
1069
|
}
|
|
1052
1070
|
export interface NewExpression extends ExpressionBase {
|
|
1053
1071
|
type: "NewExpression";
|
|
1054
1072
|
callee: Expression;
|
|
1055
|
-
arguments
|
|
1073
|
+
arguments?: Argument[];
|
|
1056
1074
|
typeArguments?: TsTypeParameterInstantiation;
|
|
1057
1075
|
}
|
|
1058
1076
|
export interface SequenceExpression extends ExpressionBase {
|
|
@@ -1073,9 +1091,9 @@ export interface YieldExpression extends ExpressionBase {
|
|
|
1073
1091
|
argument?: Expression;
|
|
1074
1092
|
delegate: boolean;
|
|
1075
1093
|
}
|
|
1076
|
-
export interface MetaProperty extends Node {
|
|
1094
|
+
export interface MetaProperty extends Node, HasSpan {
|
|
1077
1095
|
type: "MetaProperty";
|
|
1078
|
-
kind:
|
|
1096
|
+
kind: "new.target" | "import.meta";
|
|
1079
1097
|
}
|
|
1080
1098
|
export interface AwaitExpression extends ExpressionBase {
|
|
1081
1099
|
type: "AwaitExpression";
|
|
@@ -1089,14 +1107,14 @@ export interface TemplateLiteral extends ExpressionBase {
|
|
|
1089
1107
|
export interface TaggedTemplateExpression extends ExpressionBase {
|
|
1090
1108
|
type: "TaggedTemplateExpression";
|
|
1091
1109
|
tag: Expression;
|
|
1110
|
+
typeParameters?: TsTypeParameterInstantiation;
|
|
1092
1111
|
template: TemplateLiteral;
|
|
1093
|
-
typeParameters: TsTypeParameterInstantiation;
|
|
1094
1112
|
}
|
|
1095
1113
|
export interface TemplateElement extends ExpressionBase {
|
|
1096
1114
|
type: "TemplateElement";
|
|
1097
1115
|
tail: boolean;
|
|
1098
|
-
cooked
|
|
1099
|
-
raw:
|
|
1116
|
+
cooked?: string;
|
|
1117
|
+
raw: string;
|
|
1100
1118
|
}
|
|
1101
1119
|
export interface ParenthesisExpression extends ExpressionBase {
|
|
1102
1120
|
type: "ParenthesisExpression";
|
|
@@ -1104,20 +1122,15 @@ export interface ParenthesisExpression extends ExpressionBase {
|
|
|
1104
1122
|
}
|
|
1105
1123
|
export interface Fn extends HasSpan, HasDecorator {
|
|
1106
1124
|
params: Param[];
|
|
1107
|
-
body
|
|
1125
|
+
body?: BlockStatement;
|
|
1108
1126
|
generator: boolean;
|
|
1109
1127
|
async: boolean;
|
|
1110
1128
|
typeParameters?: TsTypeParameterDeclaration;
|
|
1111
1129
|
returnType?: TsTypeAnnotation;
|
|
1112
1130
|
}
|
|
1113
|
-
interface PatternBase {
|
|
1131
|
+
interface PatternBase extends Node, HasSpan {
|
|
1114
1132
|
typeAnnotation?: TsTypeAnnotation;
|
|
1115
1133
|
}
|
|
1116
|
-
export interface Identifier extends HasSpan, PatternBase {
|
|
1117
|
-
type: "Identifier";
|
|
1118
|
-
value: string;
|
|
1119
|
-
optional: boolean;
|
|
1120
|
-
}
|
|
1121
1134
|
export interface PrivateName extends ExpressionBase {
|
|
1122
1135
|
type: "PrivateName";
|
|
1123
1136
|
id: Identifier;
|
|
@@ -1139,12 +1152,12 @@ export interface JSXNamespacedName extends Node {
|
|
|
1139
1152
|
export interface JSXEmptyExpression extends Node, HasSpan {
|
|
1140
1153
|
type: "JSXEmptyExpression";
|
|
1141
1154
|
}
|
|
1142
|
-
export interface JSXExpressionContainer extends Node {
|
|
1155
|
+
export interface JSXExpressionContainer extends Node, HasSpan {
|
|
1143
1156
|
type: "JSXExpressionContainer";
|
|
1144
1157
|
expression: JSXExpression;
|
|
1145
1158
|
}
|
|
1146
1159
|
export declare type JSXExpression = JSXEmptyExpression | Expression;
|
|
1147
|
-
export interface JSXSpreadChild extends Node {
|
|
1160
|
+
export interface JSXSpreadChild extends Node, HasSpan {
|
|
1148
1161
|
type: "JSXSpreadChild";
|
|
1149
1162
|
expression: Expression;
|
|
1150
1163
|
}
|
|
@@ -1152,7 +1165,7 @@ export declare type JSXElementName = Identifier | JSXMemberExpression | JSXNames
|
|
|
1152
1165
|
export interface JSXOpeningElement extends Node, HasSpan {
|
|
1153
1166
|
type: "JSXOpeningElement";
|
|
1154
1167
|
name: JSXElementName;
|
|
1155
|
-
attributes
|
|
1168
|
+
attributes: JSXAttributeOrSpread[];
|
|
1156
1169
|
selfClosing: boolean;
|
|
1157
1170
|
typeArguments?: TsTypeParameterInstantiation;
|
|
1158
1171
|
}
|
|
@@ -1192,11 +1205,11 @@ export interface JSXOpeningFragment extends Node, HasSpan {
|
|
|
1192
1205
|
export interface JSXClosingFragment extends Node, HasSpan {
|
|
1193
1206
|
type: "JSXClosingFragment";
|
|
1194
1207
|
}
|
|
1195
|
-
export declare type Literal = StringLiteral | BooleanLiteral | NullLiteral | NumericLiteral | RegExpLiteral | JSXText;
|
|
1208
|
+
export declare type Literal = StringLiteral | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | JSXText;
|
|
1196
1209
|
export interface StringLiteral extends Node, HasSpan {
|
|
1197
1210
|
type: "StringLiteral";
|
|
1198
1211
|
value: string;
|
|
1199
|
-
|
|
1212
|
+
raw?: string;
|
|
1200
1213
|
}
|
|
1201
1214
|
export interface BooleanLiteral extends Node, HasSpan {
|
|
1202
1215
|
type: "BooleanLiteral";
|
|
@@ -1213,10 +1226,12 @@ export interface RegExpLiteral extends Node, HasSpan {
|
|
|
1213
1226
|
export interface NumericLiteral extends Node, HasSpan {
|
|
1214
1227
|
type: "NumericLiteral";
|
|
1215
1228
|
value: number;
|
|
1229
|
+
raw?: string;
|
|
1216
1230
|
}
|
|
1217
1231
|
export interface BigIntLiteral extends Node, HasSpan {
|
|
1218
1232
|
type: "BigIntLiteral";
|
|
1219
1233
|
value: bigint;
|
|
1234
|
+
raw?: string;
|
|
1220
1235
|
}
|
|
1221
1236
|
export declare type ModuleDeclaration = ImportDeclaration | ExportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportDefaultExpression | ExportAllDeclaration | TsImportEqualsDeclaration | TsExportAssignment | TsNamespaceExportDeclaration;
|
|
1222
1237
|
export interface ExportDefaultExpression extends Node, HasSpan {
|
|
@@ -1229,13 +1244,15 @@ export interface ExportDeclaration extends Node, HasSpan {
|
|
|
1229
1244
|
}
|
|
1230
1245
|
export interface ImportDeclaration extends Node, HasSpan {
|
|
1231
1246
|
type: "ImportDeclaration";
|
|
1232
|
-
typeOnly?: boolean;
|
|
1233
1247
|
specifiers: ImportSpecifier[];
|
|
1234
1248
|
source: StringLiteral;
|
|
1249
|
+
typeOnly: boolean;
|
|
1250
|
+
asserts?: ObjectExpression;
|
|
1235
1251
|
}
|
|
1236
1252
|
export interface ExportAllDeclaration extends Node, HasSpan {
|
|
1237
1253
|
type: "ExportAllDeclaration";
|
|
1238
1254
|
source: StringLiteral;
|
|
1255
|
+
asserts?: ObjectExpression;
|
|
1239
1256
|
}
|
|
1240
1257
|
/**
|
|
1241
1258
|
* - `export { foo } from 'mod'`
|
|
@@ -1246,6 +1263,7 @@ export interface ExportNamedDeclaration extends Node, HasSpan {
|
|
|
1246
1263
|
specifiers: ExportSpecifier[];
|
|
1247
1264
|
source?: StringLiteral;
|
|
1248
1265
|
typeOnly: boolean;
|
|
1266
|
+
asserts?: ObjectExpression;
|
|
1249
1267
|
}
|
|
1250
1268
|
export interface ExportDefaultDeclaration extends Node, HasSpan {
|
|
1251
1269
|
type: "ExportDefaultDeclaration";
|
|
@@ -1279,16 +1297,17 @@ export interface ImportNamespaceSpecifier extends Node, HasSpan {
|
|
|
1279
1297
|
export interface NamedImportSpecifier extends Node, HasSpan {
|
|
1280
1298
|
type: "ImportSpecifier";
|
|
1281
1299
|
local: Identifier;
|
|
1282
|
-
imported
|
|
1283
|
-
isTypeOnly
|
|
1300
|
+
imported?: ModuleExportName;
|
|
1301
|
+
isTypeOnly: boolean;
|
|
1284
1302
|
}
|
|
1303
|
+
export declare type ModuleExportName = Identifier | StringLiteral;
|
|
1285
1304
|
export declare type ExportSpecifier = ExportNamespaceSpecifier | ExportDefaultSpecifier | NamedExportSpecifier;
|
|
1286
1305
|
/**
|
|
1287
1306
|
* `export * as foo from 'src';`
|
|
1288
1307
|
*/
|
|
1289
1308
|
export interface ExportNamespaceSpecifier extends Node, HasSpan {
|
|
1290
1309
|
type: "ExportNamespaceSpecifier";
|
|
1291
|
-
name:
|
|
1310
|
+
name: ModuleExportName;
|
|
1292
1311
|
}
|
|
1293
1312
|
export interface ExportDefaultSpecifier extends Node, HasSpan {
|
|
1294
1313
|
type: "ExportDefaultSpecifier";
|
|
@@ -1296,12 +1315,12 @@ export interface ExportDefaultSpecifier extends Node, HasSpan {
|
|
|
1296
1315
|
}
|
|
1297
1316
|
export interface NamedExportSpecifier extends Node, HasSpan {
|
|
1298
1317
|
type: "ExportSpecifier";
|
|
1299
|
-
orig:
|
|
1318
|
+
orig: ModuleExportName;
|
|
1300
1319
|
/**
|
|
1301
1320
|
* `Some(bar)` in `export { foo as bar }`
|
|
1302
1321
|
*/
|
|
1303
|
-
exported
|
|
1304
|
-
isTypeOnly
|
|
1322
|
+
exported?: ModuleExportName;
|
|
1323
|
+
isTypeOnly: boolean;
|
|
1305
1324
|
}
|
|
1306
1325
|
interface HasInterpreter {
|
|
1307
1326
|
/**
|
|
@@ -1319,25 +1338,32 @@ export interface Script extends Node, HasSpan, HasInterpreter {
|
|
|
1319
1338
|
body: Statement[];
|
|
1320
1339
|
}
|
|
1321
1340
|
export declare type ModuleItem = ModuleDeclaration | Statement;
|
|
1322
|
-
export declare type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "
|
|
1323
|
-
export declare type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "
|
|
1341
|
+
export declare type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "||" | "&&" | "in" | "instanceof" | "**" | "??";
|
|
1342
|
+
export declare type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "&&=" | "||=" | "??=";
|
|
1324
1343
|
export declare type UpdateOperator = "++" | "--";
|
|
1325
1344
|
export declare type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
1326
|
-
export declare type Pattern =
|
|
1327
|
-
export interface
|
|
1345
|
+
export declare type Pattern = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern | AssignmentPattern | Invalid | Expression;
|
|
1346
|
+
export interface BindingIdentifier extends PatternBase {
|
|
1347
|
+
type: "Identifier";
|
|
1348
|
+
value: string;
|
|
1349
|
+
optional: boolean;
|
|
1350
|
+
}
|
|
1351
|
+
export interface ArrayPattern extends PatternBase {
|
|
1328
1352
|
type: "ArrayPattern";
|
|
1329
1353
|
elements: (Pattern | undefined)[];
|
|
1354
|
+
optional: boolean;
|
|
1330
1355
|
}
|
|
1331
|
-
export interface ObjectPattern extends
|
|
1356
|
+
export interface ObjectPattern extends PatternBase {
|
|
1332
1357
|
type: "ObjectPattern";
|
|
1333
1358
|
properties: ObjectPatternProperty[];
|
|
1359
|
+
optional: boolean;
|
|
1334
1360
|
}
|
|
1335
|
-
export interface AssignmentPattern extends
|
|
1361
|
+
export interface AssignmentPattern extends PatternBase {
|
|
1336
1362
|
type: "AssignmentPattern";
|
|
1337
1363
|
left: Pattern;
|
|
1338
1364
|
right: Expression;
|
|
1339
1365
|
}
|
|
1340
|
-
export interface RestElement extends
|
|
1366
|
+
export interface RestElement extends PatternBase {
|
|
1341
1367
|
type: "RestElement";
|
|
1342
1368
|
rest: Span;
|
|
1343
1369
|
argument: Pattern;
|
|
@@ -1376,17 +1402,17 @@ export interface AssignmentProperty extends Node {
|
|
|
1376
1402
|
export interface GetterProperty extends PropBase, HasSpan {
|
|
1377
1403
|
type: "GetterProperty";
|
|
1378
1404
|
typeAnnotation?: TsTypeAnnotation;
|
|
1379
|
-
body
|
|
1405
|
+
body?: BlockStatement;
|
|
1380
1406
|
}
|
|
1381
1407
|
export interface SetterProperty extends PropBase, HasSpan {
|
|
1382
1408
|
type: "SetterProperty";
|
|
1383
1409
|
param: Pattern;
|
|
1384
|
-
body
|
|
1410
|
+
body?: BlockStatement;
|
|
1385
1411
|
}
|
|
1386
1412
|
export interface MethodProperty extends PropBase, Fn {
|
|
1387
1413
|
type: "MethodProperty";
|
|
1388
1414
|
}
|
|
1389
|
-
export declare type PropertyName = Identifier | StringLiteral | NumericLiteral |
|
|
1415
|
+
export declare type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropName | BigIntLiteral;
|
|
1390
1416
|
export interface ComputedPropName extends Node, HasSpan {
|
|
1391
1417
|
type: "Computed";
|
|
1392
1418
|
expression: Expression;
|
|
@@ -1399,7 +1425,7 @@ export interface ExpressionStatement extends Node, HasSpan {
|
|
|
1399
1425
|
type: "ExpressionStatement";
|
|
1400
1426
|
expression: Expression;
|
|
1401
1427
|
}
|
|
1402
|
-
export declare type Statement =
|
|
1428
|
+
export declare type Statement = BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration | ExpressionStatement;
|
|
1403
1429
|
export interface EmptyStatement extends Node, HasSpan {
|
|
1404
1430
|
type: "EmptyStatement";
|
|
1405
1431
|
}
|
|
@@ -1413,7 +1439,7 @@ export interface WithStatement extends Node, HasSpan {
|
|
|
1413
1439
|
}
|
|
1414
1440
|
export interface ReturnStatement extends Node, HasSpan {
|
|
1415
1441
|
type: "ReturnStatement";
|
|
1416
|
-
argument
|
|
1442
|
+
argument?: Expression;
|
|
1417
1443
|
}
|
|
1418
1444
|
export interface LabeledStatement extends Node, HasSpan {
|
|
1419
1445
|
type: "LabeledStatement";
|
|
@@ -1422,11 +1448,11 @@ export interface LabeledStatement extends Node, HasSpan {
|
|
|
1422
1448
|
}
|
|
1423
1449
|
export interface BreakStatement extends Node, HasSpan {
|
|
1424
1450
|
type: "BreakStatement";
|
|
1425
|
-
label
|
|
1451
|
+
label?: Identifier;
|
|
1426
1452
|
}
|
|
1427
1453
|
export interface ContinueStatement extends Node, HasSpan {
|
|
1428
1454
|
type: "ContinueStatement";
|
|
1429
|
-
label
|
|
1455
|
+
label?: Identifier;
|
|
1430
1456
|
}
|
|
1431
1457
|
export interface IfStatement extends Node, HasSpan {
|
|
1432
1458
|
type: "IfStatement";
|
|
@@ -1447,7 +1473,7 @@ export interface TryStatement extends Node, HasSpan {
|
|
|
1447
1473
|
type: "TryStatement";
|
|
1448
1474
|
block: BlockStatement;
|
|
1449
1475
|
handler?: CatchClause;
|
|
1450
|
-
finalizer
|
|
1476
|
+
finalizer?: BlockStatement;
|
|
1451
1477
|
}
|
|
1452
1478
|
export interface WhileStatement extends Node, HasSpan {
|
|
1453
1479
|
type: "WhileStatement";
|
|
@@ -1479,7 +1505,7 @@ export interface ForOfStatement extends Node, HasSpan {
|
|
|
1479
1505
|
*
|
|
1480
1506
|
* es2018 for-await-of statements, e.g., `for await (const x of xs) {`
|
|
1481
1507
|
*/
|
|
1482
|
-
await
|
|
1508
|
+
await?: Span;
|
|
1483
1509
|
left: VariableDeclaration | Pattern;
|
|
1484
1510
|
right: Expression;
|
|
1485
1511
|
body: Statement;
|
|
@@ -1497,7 +1523,7 @@ export interface CatchClause extends Node, HasSpan {
|
|
|
1497
1523
|
/**
|
|
1498
1524
|
* The param is `undefined` if the catch binding is omitted. E.g., `try { foo() } catch {}`
|
|
1499
1525
|
*/
|
|
1500
|
-
param
|
|
1526
|
+
param?: Pattern;
|
|
1501
1527
|
body: BlockStatement;
|
|
1502
1528
|
}
|
|
1503
1529
|
export interface TsTypeAnnotation extends Node, HasSpan {
|
|
@@ -1511,8 +1537,10 @@ export interface TsTypeParameterDeclaration extends Node, HasSpan {
|
|
|
1511
1537
|
export interface TsTypeParameter extends Node, HasSpan {
|
|
1512
1538
|
type: "TsTypeParameter";
|
|
1513
1539
|
name: Identifier;
|
|
1514
|
-
|
|
1515
|
-
|
|
1540
|
+
in: boolean;
|
|
1541
|
+
out: boolean;
|
|
1542
|
+
constraint?: TsType;
|
|
1543
|
+
default?: TsType;
|
|
1516
1544
|
}
|
|
1517
1545
|
export interface TsTypeParameterInstantiation extends Node, HasSpan {
|
|
1518
1546
|
type: "TsTypeParameterInstantiation";
|
|
@@ -1521,28 +1549,29 @@ export interface TsTypeParameterInstantiation extends Node, HasSpan {
|
|
|
1521
1549
|
export interface TsParameterProperty extends Node, HasSpan, HasDecorator {
|
|
1522
1550
|
type: "TsParameterProperty";
|
|
1523
1551
|
accessibility?: Accessibility;
|
|
1552
|
+
override: boolean;
|
|
1524
1553
|
readonly: boolean;
|
|
1525
1554
|
param: TsParameterPropertyParameter;
|
|
1526
1555
|
}
|
|
1527
|
-
export declare type TsParameterPropertyParameter =
|
|
1556
|
+
export declare type TsParameterPropertyParameter = BindingIdentifier | AssignmentPattern;
|
|
1528
1557
|
export interface TsQualifiedName extends Node {
|
|
1529
1558
|
type: "TsQualifiedName";
|
|
1530
1559
|
left: TsEntityName;
|
|
1531
1560
|
right: Identifier;
|
|
1532
1561
|
}
|
|
1533
1562
|
export declare type TsEntityName = TsQualifiedName | Identifier;
|
|
1534
|
-
export declare type TsTypeElement = TsCallSignatureDeclaration | TsConstructSignatureDeclaration | TsPropertySignature | TsMethodSignature | TsIndexSignature;
|
|
1563
|
+
export declare type TsTypeElement = TsCallSignatureDeclaration | TsConstructSignatureDeclaration | TsPropertySignature | TsGetterSignature | TsSetterSignature | TsMethodSignature | TsIndexSignature;
|
|
1535
1564
|
export interface TsCallSignatureDeclaration extends Node, HasSpan {
|
|
1536
1565
|
type: "TsCallSignatureDeclaration";
|
|
1537
1566
|
params: TsFnParameter[];
|
|
1538
|
-
typeAnnotation
|
|
1539
|
-
typeParams
|
|
1567
|
+
typeAnnotation?: TsTypeAnnotation;
|
|
1568
|
+
typeParams?: TsTypeParameterDeclaration;
|
|
1540
1569
|
}
|
|
1541
1570
|
export interface TsConstructSignatureDeclaration extends Node, HasSpan {
|
|
1542
1571
|
type: "TsConstructSignatureDeclaration";
|
|
1543
1572
|
params: TsFnParameter[];
|
|
1544
|
-
typeAnnotation
|
|
1545
|
-
typeParams
|
|
1573
|
+
typeAnnotation?: TsTypeAnnotation;
|
|
1574
|
+
typeParams?: TsTypeParameterDeclaration;
|
|
1546
1575
|
}
|
|
1547
1576
|
export interface TsPropertySignature extends Node, HasSpan {
|
|
1548
1577
|
type: "TsPropertySignature";
|
|
@@ -1550,10 +1579,26 @@ export interface TsPropertySignature extends Node, HasSpan {
|
|
|
1550
1579
|
key: Expression;
|
|
1551
1580
|
computed: boolean;
|
|
1552
1581
|
optional: boolean;
|
|
1553
|
-
init
|
|
1582
|
+
init?: Expression;
|
|
1554
1583
|
params: TsFnParameter[];
|
|
1555
1584
|
typeAnnotation?: TsTypeAnnotation;
|
|
1556
|
-
typeParams
|
|
1585
|
+
typeParams?: TsTypeParameterDeclaration;
|
|
1586
|
+
}
|
|
1587
|
+
export interface TsGetterSignature extends Node, HasSpan {
|
|
1588
|
+
type: "TsGetterSignature";
|
|
1589
|
+
readonly: boolean;
|
|
1590
|
+
key: Expression;
|
|
1591
|
+
computed: boolean;
|
|
1592
|
+
optional: boolean;
|
|
1593
|
+
typeAnnotation?: TsTypeAnnotation;
|
|
1594
|
+
}
|
|
1595
|
+
export interface TsSetterSignature extends Node, HasSpan {
|
|
1596
|
+
type: "TsSetterSignature";
|
|
1597
|
+
readonly: boolean;
|
|
1598
|
+
key: Expression;
|
|
1599
|
+
computed: boolean;
|
|
1600
|
+
optional: boolean;
|
|
1601
|
+
param: TsFnParameter;
|
|
1557
1602
|
}
|
|
1558
1603
|
export interface TsMethodSignature extends Node, HasSpan {
|
|
1559
1604
|
type: "TsMethodSignature";
|
|
@@ -1562,50 +1607,54 @@ export interface TsMethodSignature extends Node, HasSpan {
|
|
|
1562
1607
|
computed: boolean;
|
|
1563
1608
|
optional: boolean;
|
|
1564
1609
|
params: TsFnParameter[];
|
|
1565
|
-
|
|
1566
|
-
typeParams
|
|
1610
|
+
typeAnn?: TsTypeAnnotation;
|
|
1611
|
+
typeParams?: TsTypeParameterDeclaration;
|
|
1567
1612
|
}
|
|
1568
1613
|
export interface TsIndexSignature extends Node, HasSpan {
|
|
1569
1614
|
type: "TsIndexSignature";
|
|
1570
|
-
readonly: boolean;
|
|
1571
1615
|
params: TsFnParameter[];
|
|
1572
1616
|
typeAnnotation?: TsTypeAnnotation;
|
|
1617
|
+
readonly: boolean;
|
|
1618
|
+
static: boolean;
|
|
1573
1619
|
}
|
|
1574
|
-
export declare type TsType = TsKeywordType | TsThisType | TsFnOrConstructorType | TsTypeReference | TsTypeQuery | TsTypeLiteral | TsArrayType | TsTupleType | TsOptionalType | TsRestType | TsUnionOrIntersectionType | TsConditionalType | TsInferType | TsParenthesizedType | TsTypeOperator | TsIndexedAccessType | TsMappedType | TsLiteralType |
|
|
1620
|
+
export declare type TsType = TsKeywordType | TsThisType | TsFnOrConstructorType | TsTypeReference | TsTypeQuery | TsTypeLiteral | TsArrayType | TsTupleType | TsOptionalType | TsRestType | TsUnionOrIntersectionType | TsConditionalType | TsInferType | TsParenthesizedType | TsTypeOperator | TsIndexedAccessType | TsMappedType | TsLiteralType | TsTypePredicate | TsImportType;
|
|
1575
1621
|
export declare type TsFnOrConstructorType = TsFunctionType | TsConstructorType;
|
|
1576
1622
|
export interface TsKeywordType extends Node, HasSpan {
|
|
1577
1623
|
type: "TsKeywordType";
|
|
1578
1624
|
kind: TsKeywordTypeKind;
|
|
1579
1625
|
}
|
|
1580
|
-
export declare type TsKeywordTypeKind = "any" | "unknown" | "number" | "object" | "boolean" | "bigint" | "string" | "symbol" | "void" | "undefined" | "null" | "never";
|
|
1626
|
+
export declare type TsKeywordTypeKind = "any" | "unknown" | "number" | "object" | "boolean" | "bigint" | "string" | "symbol" | "void" | "undefined" | "null" | "never" | "intrinsic";
|
|
1581
1627
|
export interface TsThisType extends Node, HasSpan {
|
|
1582
1628
|
type: "TsThisType";
|
|
1583
1629
|
}
|
|
1584
|
-
export declare type TsFnParameter =
|
|
1630
|
+
export declare type TsFnParameter = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern;
|
|
1585
1631
|
export interface TsFunctionType extends Node, HasSpan {
|
|
1586
1632
|
type: "TsFunctionType";
|
|
1587
|
-
|
|
1633
|
+
params: TsFnParameter[];
|
|
1634
|
+
typeParams?: TsTypeParameterDeclaration;
|
|
1588
1635
|
typeAnnotation: TsTypeAnnotation;
|
|
1589
1636
|
}
|
|
1590
1637
|
export interface TsConstructorType extends Node, HasSpan {
|
|
1591
1638
|
type: "TsConstructorType";
|
|
1592
1639
|
params: TsFnParameter[];
|
|
1593
|
-
typeParams
|
|
1640
|
+
typeParams?: TsTypeParameterDeclaration;
|
|
1594
1641
|
typeAnnotation: TsTypeAnnotation;
|
|
1642
|
+
isAbstract: boolean;
|
|
1595
1643
|
}
|
|
1596
1644
|
export interface TsTypeReference extends Node, HasSpan {
|
|
1597
1645
|
type: "TsTypeReference";
|
|
1598
1646
|
typeName: TsEntityName;
|
|
1599
|
-
typeParams
|
|
1647
|
+
typeParams?: TsTypeParameterInstantiation;
|
|
1600
1648
|
}
|
|
1601
1649
|
export interface TsTypePredicate extends Node, HasSpan {
|
|
1602
1650
|
type: "TsTypePredicate";
|
|
1603
1651
|
asserts: boolean;
|
|
1604
1652
|
paramName: TsThisTypeOrIdent;
|
|
1605
|
-
typeAnnotation
|
|
1653
|
+
typeAnnotation?: TsTypeAnnotation;
|
|
1606
1654
|
}
|
|
1607
1655
|
export declare type TsThisTypeOrIdent = TsThisType | Identifier;
|
|
1608
1656
|
export interface TsImportType extends Node, HasSpan {
|
|
1657
|
+
type: "TsImportType";
|
|
1609
1658
|
argument: StringLiteral;
|
|
1610
1659
|
qualifier?: TsEntityName;
|
|
1611
1660
|
typeArguments?: TsTypeParameterInstantiation;
|
|
@@ -1616,6 +1665,7 @@ export interface TsImportType extends Node, HasSpan {
|
|
|
1616
1665
|
export interface TsTypeQuery extends Node, HasSpan {
|
|
1617
1666
|
type: "TsTypeQuery";
|
|
1618
1667
|
exprName: TsTypeQueryExpr;
|
|
1668
|
+
typeArguments?: TsTypeParameterInstantiation;
|
|
1619
1669
|
}
|
|
1620
1670
|
export declare type TsTypeQueryExpr = TsEntityName | TsImportType;
|
|
1621
1671
|
export interface TsTypeLiteral extends Node, HasSpan {
|
|
@@ -1628,7 +1678,12 @@ export interface TsArrayType extends Node, HasSpan {
|
|
|
1628
1678
|
}
|
|
1629
1679
|
export interface TsTupleType extends Node, HasSpan {
|
|
1630
1680
|
type: "TsTupleType";
|
|
1631
|
-
elemTypes:
|
|
1681
|
+
elemTypes: TsTupleElement[];
|
|
1682
|
+
}
|
|
1683
|
+
export interface TsTupleElement extends Node, HasSpan {
|
|
1684
|
+
type: "TsTupleElement";
|
|
1685
|
+
label?: Pattern;
|
|
1686
|
+
ty: TsType;
|
|
1632
1687
|
}
|
|
1633
1688
|
export interface TsOptionalType extends Node, HasSpan {
|
|
1634
1689
|
type: "TsOptionalType";
|
|
@@ -1667,25 +1722,32 @@ export interface TsTypeOperator extends Node, HasSpan {
|
|
|
1667
1722
|
op: TsTypeOperatorOp;
|
|
1668
1723
|
typeAnnotation: TsType;
|
|
1669
1724
|
}
|
|
1670
|
-
export declare type TsTypeOperatorOp = "keyof" | "unique";
|
|
1725
|
+
export declare type TsTypeOperatorOp = "keyof" | "unique" | "readonly";
|
|
1671
1726
|
export interface TsIndexedAccessType extends Node, HasSpan {
|
|
1672
1727
|
type: "TsIndexedAccessType";
|
|
1728
|
+
readonly: boolean;
|
|
1673
1729
|
objectType: TsType;
|
|
1674
1730
|
indexType: TsType;
|
|
1675
1731
|
}
|
|
1676
1732
|
export declare type TruePlusMinus = true | "+" | "-";
|
|
1677
1733
|
export interface TsMappedType extends Node, HasSpan {
|
|
1678
1734
|
type: "TsMappedType";
|
|
1679
|
-
readonly
|
|
1735
|
+
readonly?: TruePlusMinus;
|
|
1680
1736
|
typeParam: TsTypeParameter;
|
|
1681
|
-
|
|
1682
|
-
|
|
1737
|
+
nameType?: TsType;
|
|
1738
|
+
optional?: TruePlusMinus;
|
|
1739
|
+
typeAnnotation?: TsType;
|
|
1683
1740
|
}
|
|
1684
1741
|
export interface TsLiteralType extends Node, HasSpan {
|
|
1685
1742
|
type: "TsLiteralType";
|
|
1686
1743
|
literal: TsLiteral;
|
|
1687
1744
|
}
|
|
1688
|
-
export declare type TsLiteral = NumericLiteral | StringLiteral | BooleanLiteral |
|
|
1745
|
+
export declare type TsLiteral = NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TsTemplateLiteralType;
|
|
1746
|
+
export interface TsTemplateLiteralType extends Node, HasSpan {
|
|
1747
|
+
type: "TemplateLiteral";
|
|
1748
|
+
types: TsType[];
|
|
1749
|
+
quasis: TemplateElement[];
|
|
1750
|
+
}
|
|
1689
1751
|
export interface TsInterfaceDeclaration extends Node, HasSpan {
|
|
1690
1752
|
type: "TsInterfaceDeclaration";
|
|
1691
1753
|
id: Identifier;
|
|
@@ -1700,7 +1762,7 @@ export interface TsInterfaceBody extends Node, HasSpan {
|
|
|
1700
1762
|
}
|
|
1701
1763
|
export interface TsExpressionWithTypeArguments extends Node, HasSpan {
|
|
1702
1764
|
type: "TsExpressionWithTypeArguments";
|
|
1703
|
-
expression:
|
|
1765
|
+
expression: Expression;
|
|
1704
1766
|
typeArguments?: TsTypeParameterInstantiation;
|
|
1705
1767
|
}
|
|
1706
1768
|
export interface TsTypeAliasDeclaration extends Node, HasSpan {
|
|
@@ -1713,7 +1775,7 @@ export interface TsTypeAliasDeclaration extends Node, HasSpan {
|
|
|
1713
1775
|
export interface TsEnumDeclaration extends Node, HasSpan {
|
|
1714
1776
|
type: "TsEnumDeclaration";
|
|
1715
1777
|
declare: boolean;
|
|
1716
|
-
|
|
1778
|
+
isConst: boolean;
|
|
1717
1779
|
id: Identifier;
|
|
1718
1780
|
members: TsEnumMember[];
|
|
1719
1781
|
}
|
|
@@ -1749,14 +1811,15 @@ export declare type TsModuleName = Identifier | StringLiteral;
|
|
|
1749
1811
|
export interface TsImportEqualsDeclaration extends Node, HasSpan {
|
|
1750
1812
|
type: "TsImportEqualsDeclaration";
|
|
1751
1813
|
declare: boolean;
|
|
1752
|
-
|
|
1814
|
+
isExport: boolean;
|
|
1815
|
+
isTypeOnly: boolean;
|
|
1753
1816
|
id: Identifier;
|
|
1754
1817
|
moduleRef: TsModuleReference;
|
|
1755
1818
|
}
|
|
1756
1819
|
export declare type TsModuleReference = TsEntityName | TsExternalModuleReference;
|
|
1757
1820
|
export interface TsExternalModuleReference extends Node, HasSpan {
|
|
1758
1821
|
type: "TsExternalModuleReference";
|
|
1759
|
-
expression:
|
|
1822
|
+
expression: StringLiteral;
|
|
1760
1823
|
}
|
|
1761
1824
|
export interface TsExportAssignment extends Node, HasSpan {
|
|
1762
1825
|
type: "TsExportAssignment";
|
|
@@ -1771,6 +1834,11 @@ export interface TsAsExpression extends ExpressionBase {
|
|
|
1771
1834
|
expression: Expression;
|
|
1772
1835
|
typeAnnotation: TsType;
|
|
1773
1836
|
}
|
|
1837
|
+
export interface TsInstantiation extends Node, HasSpan {
|
|
1838
|
+
type: "TsInstantiation";
|
|
1839
|
+
expression: Expression;
|
|
1840
|
+
typeArguments: TsTypeParameterInstantiation;
|
|
1841
|
+
}
|
|
1774
1842
|
export interface TsTypeAssertion extends ExpressionBase {
|
|
1775
1843
|
type: "TsTypeAssertion";
|
|
1776
1844
|
expression: Expression;
|