@@ -428,11 +428,9 @@ export type MethodDefinition =
428
428
export type Modifier =
429
429
| TSAbstractKeyword
430
430
| TSAsyncKeyword
431
- | TSDeclareKeyword
432
- | TSExportKeyword
433
- | TSPublicKeyword
434
431
| TSPrivateKeyword
435
432
| TSProtectedKeyword
433
+ | TSPublicKeyword
436
434
| TSReadonlyKeyword
437
435
| TSStaticKeyword ;
438
436
export type ObjectLiteralElementLike =
@@ -465,20 +463,8 @@ export type PrimaryExpression =
465
463
| TemplateLiteral
466
464
| ThisExpression
467
465
| TSNullKeyword ;
468
- export type ProgramStatement =
469
- | ClassDeclaration
470
- | ExportAllDeclaration
471
- | ExportDefaultDeclaration
472
- | ExportNamedDeclaration
473
- | ImportDeclaration
474
- | Statement
475
- | TSDeclareFunction
476
- | TSEnumDeclaration
477
- | TSExportAssignment
478
- | TSImportEqualsDeclaration
479
- | TSInterfaceDeclaration
480
- | TSNamespaceExportDeclaration
481
- | TSTypeAliasDeclaration ;
466
+ /** TODO: re-align this with EStree spec in next major release */
467
+ export type ProgramStatement = Statement ;
482
468
export type Property = PropertyComputedName | PropertyNonComputedName ;
483
469
export type PropertyName = PropertyNameComputed | PropertyNameNonComputed ;
484
470
export type PropertyNameComputed = Expression ;
@@ -489,16 +475,27 @@ export type PropertyNameNonComputed =
489
475
export type Statement =
490
476
| BlockStatement
491
477
| BreakStatement
478
+ | ClassDeclaration
492
479
| ContinueStatement
493
480
| DebuggerStatement
494
481
| DeclarationStatement
495
482
| EmptyStatement
483
+ | ExportAllDeclaration
484
+ | ExportDefaultDeclaration
485
+ | ExportNamedDeclaration
496
486
| ExpressionStatement
497
487
| IfStatement
498
488
| IterationStatement
499
489
| ImportDeclaration
500
490
| LabeledStatement
491
+ | TSDeclareFunction
492
+ | TSEnumDeclaration
493
+ | TSExportAssignment
494
+ | TSImportEqualsDeclaration
495
+ | TSInterfaceDeclaration
501
496
| TSModuleBlock
497
+ | TSNamespaceExportDeclaration
498
+ | TSTypeAliasDeclaration
502
499
| ReturnStatement
503
500
| SwitchStatement
504
501
| ThrowStatement
@@ -1079,7 +1076,7 @@ export interface JSXOpeningElement extends BaseNode {
1079
1076
typeParameters ?: TSTypeParameterInstantiation ;
1080
1077
selfClosing : boolean ;
1081
1078
name : JSXTagNameExpression ;
1082
- attributes : JSXAttribute [ ] ;
1079
+ attributes : ( JSXAttribute | JSXSpreadAttribute ) [ ] ;
1083
1080
}
1084
1081
1085
1082
export interface JSXOpeningFragment extends BaseNode {
@@ -1170,7 +1167,7 @@ export interface ObjectPattern extends BaseNode {
1170
1167
1171
1168
export interface Program extends BaseNode {
1172
1169
type : AST_NODE_TYPES . Program ;
1173
- body : ProgramStatement [ ] ;
1170
+ body : Statement [ ] ;
1174
1171
sourceType : 'module' | 'script' ;
1175
1172
comments ?: Comment [ ] ;
1176
1173
tokens ?: Token [ ] ;
@@ -1188,7 +1185,7 @@ export interface PropertyNonComputedName extends PropertyBase {
1188
1185
1189
1186
export interface RegExpLiteral extends LiteralBase {
1190
1187
type : AST_NODE_TYPES . Literal ;
1191
- value : RegExp ;
1188
+ value : RegExp | null ;
1192
1189
}
1193
1190
1194
1191
export interface RestElement extends BaseNode {
@@ -1271,7 +1268,7 @@ export interface TryStatement extends BaseNode {
1271
1268
type : AST_NODE_TYPES . TryStatement ;
1272
1269
block : BlockStatement ;
1273
1270
handler : CatchClause | null ;
1274
- finalizer : BlockStatement ;
1271
+ finalizer : BlockStatement | null ;
1275
1272
}
1276
1273
1277
1274
export interface TSAbstractClassPropertyComputedName
@@ -1502,13 +1499,13 @@ export interface TSMethodSignatureNonComputedName
1502
1499
1503
1500
export interface TSModuleBlock extends BaseNode {
1504
1501
type : AST_NODE_TYPES . TSModuleBlock ;
1505
- body : ProgramStatement [ ] ;
1502
+ body : Statement [ ] ;
1506
1503
}
1507
1504
1508
1505
export interface TSModuleDeclaration extends BaseNode {
1509
1506
type : AST_NODE_TYPES . TSModuleDeclaration ;
1510
1507
id : Identifier | Literal ;
1511
- body ?: TSModuleBlock ;
1508
+ body ?: TSModuleBlock | TSModuleDeclaration ;
1512
1509
global ?: boolean ;
1513
1510
declare ?: boolean ;
1514
1511
modifiers ?: Modifier [ ] ;
0 commit comments