ast-types 0.12.0 → 0.12.1
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/def/flow.js +3 -2
- package/gen/builders.d.ts +9 -48
- package/gen/kinds.d.ts +5 -28
- package/gen/namedTypes.d.ts +0 -23
- package/gen/nodes.d.ts +5 -84
- package/gen/visitor.d.ts +0 -23
- package/main.js +0 -4
- package/package.json +1 -1
- package/def/e4x.d.ts +0 -2
- package/def/e4x.js +0 -75
- package/def/mozilla.d.ts +0 -2
- package/def/mozilla.js +0 -46
- package/lib/type-annotations.d.ts +0 -11
- package/lib/type-annotations.js +0 -90
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +0 -18
package/def/flow.js
CHANGED
|
@@ -109,6 +109,7 @@ function default_1(fork) {
|
|
|
109
109
|
])
|
|
110
110
|
.field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray)
|
|
111
111
|
.field("callProperties", [def("ObjectTypeCallProperty")], defaults.emptyArray)
|
|
112
|
+
.field("inexact", or(Boolean, void 0), defaults["undefined"])
|
|
112
113
|
.field("exact", Boolean, defaults["false"])
|
|
113
114
|
.field("internalSlots", [def("ObjectTypeInternalSlot")], defaults.emptyArray);
|
|
114
115
|
def("Variance")
|
|
@@ -227,8 +228,8 @@ function default_1(fork) {
|
|
|
227
228
|
.build("id", "typeParameters", "impltype", "supertype")
|
|
228
229
|
.field("id", def("Identifier"))
|
|
229
230
|
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
|
|
230
|
-
.field("
|
|
231
|
-
.field("
|
|
231
|
+
.field("impltype", def("FlowType"))
|
|
232
|
+
.field("supertype", def("FlowType"));
|
|
232
233
|
def("DeclareTypeAlias")
|
|
233
234
|
.bases("TypeAlias")
|
|
234
235
|
.build("id", "typeParameters", "right");
|
package/gen/builders.d.ts
CHANGED
|
@@ -193,11 +193,10 @@ export interface VariableDeclarationBuilder {
|
|
|
193
193
|
}): N.VariableDeclaration;
|
|
194
194
|
}
|
|
195
195
|
export interface ForInStatementBuilder {
|
|
196
|
-
(left: K.VariableDeclarationKind | K.ExpressionKind, right: K.ExpressionKind, body: K.StatementKind
|
|
196
|
+
(left: K.VariableDeclarationKind | K.ExpressionKind, right: K.ExpressionKind, body: K.StatementKind): N.ForInStatement;
|
|
197
197
|
from(params: {
|
|
198
198
|
body: K.StatementKind;
|
|
199
199
|
comments?: K.CommentKind[] | null;
|
|
200
|
-
each?: boolean;
|
|
201
200
|
left: K.VariableDeclarationKind | K.ExpressionKind;
|
|
202
201
|
loc?: K.SourceLocationKind | null;
|
|
203
202
|
right: K.ExpressionKind;
|
|
@@ -211,10 +210,10 @@ export interface DebuggerStatementBuilder {
|
|
|
211
210
|
}): N.DebuggerStatement;
|
|
212
211
|
}
|
|
213
212
|
export interface FunctionDeclarationBuilder {
|
|
214
|
-
(id: K.IdentifierKind, params: K.PatternKind[], body: K.BlockStatementKind
|
|
213
|
+
(id: K.IdentifierKind, params: K.PatternKind[], body: K.BlockStatementKind, generator?: boolean, expression?: boolean): N.FunctionDeclaration;
|
|
215
214
|
from(params: {
|
|
216
215
|
async?: boolean;
|
|
217
|
-
body: K.BlockStatementKind
|
|
216
|
+
body: K.BlockStatementKind;
|
|
218
217
|
comments?: K.CommentKind[] | null;
|
|
219
218
|
defaults?: (K.ExpressionKind | null)[];
|
|
220
219
|
expression?: boolean;
|
|
@@ -228,10 +227,10 @@ export interface FunctionDeclarationBuilder {
|
|
|
228
227
|
}): N.FunctionDeclaration;
|
|
229
228
|
}
|
|
230
229
|
export interface FunctionExpressionBuilder {
|
|
231
|
-
(id: K.IdentifierKind | null | undefined, params: K.PatternKind[], body: K.BlockStatementKind
|
|
230
|
+
(id: K.IdentifierKind | null | undefined, params: K.PatternKind[], body: K.BlockStatementKind, generator?: boolean, expression?: boolean): N.FunctionExpression;
|
|
232
231
|
from(params: {
|
|
233
232
|
async?: boolean;
|
|
234
|
-
body: K.BlockStatementKind
|
|
233
|
+
body: K.BlockStatementKind;
|
|
235
234
|
comments?: K.CommentKind[] | null;
|
|
236
235
|
defaults?: (K.ExpressionKind | null)[];
|
|
237
236
|
expression?: boolean;
|
|
@@ -721,41 +720,6 @@ export interface AwaitExpressionBuilder {
|
|
|
721
720
|
loc?: K.SourceLocationKind | null;
|
|
722
721
|
}): N.AwaitExpression;
|
|
723
722
|
}
|
|
724
|
-
export interface LetStatementBuilder {
|
|
725
|
-
(head: K.VariableDeclaratorKind[], body: K.StatementKind): N.LetStatement;
|
|
726
|
-
from(params: {
|
|
727
|
-
body: K.StatementKind;
|
|
728
|
-
comments?: K.CommentKind[] | null;
|
|
729
|
-
head: K.VariableDeclaratorKind[];
|
|
730
|
-
loc?: K.SourceLocationKind | null;
|
|
731
|
-
}): N.LetStatement;
|
|
732
|
-
}
|
|
733
|
-
export interface LetExpressionBuilder {
|
|
734
|
-
(head: K.VariableDeclaratorKind[], body: K.ExpressionKind): N.LetExpression;
|
|
735
|
-
from(params: {
|
|
736
|
-
body: K.ExpressionKind;
|
|
737
|
-
comments?: K.CommentKind[] | null;
|
|
738
|
-
head: K.VariableDeclaratorKind[];
|
|
739
|
-
loc?: K.SourceLocationKind | null;
|
|
740
|
-
}): N.LetExpression;
|
|
741
|
-
}
|
|
742
|
-
export interface GraphExpressionBuilder {
|
|
743
|
-
(index: number, expression: K.LiteralKind): N.GraphExpression;
|
|
744
|
-
from(params: {
|
|
745
|
-
comments?: K.CommentKind[] | null;
|
|
746
|
-
expression: K.LiteralKind;
|
|
747
|
-
index: number;
|
|
748
|
-
loc?: K.SourceLocationKind | null;
|
|
749
|
-
}): N.GraphExpression;
|
|
750
|
-
}
|
|
751
|
-
export interface GraphIndexExpressionBuilder {
|
|
752
|
-
(index: number): N.GraphIndexExpression;
|
|
753
|
-
from(params: {
|
|
754
|
-
comments?: K.CommentKind[] | null;
|
|
755
|
-
index: number;
|
|
756
|
-
loc?: K.SourceLocationKind | null;
|
|
757
|
-
}): N.GraphIndexExpression;
|
|
758
|
-
}
|
|
759
723
|
export interface JSXAttributeBuilder {
|
|
760
724
|
(name: K.JSXIdentifierKind | K.JSXNamespacedNameKind, value?: K.LiteralKind | K.JSXExpressionContainerKind | null): N.JSXAttribute;
|
|
761
725
|
from(params: {
|
|
@@ -1107,6 +1071,7 @@ export interface ObjectTypeAnnotationBuilder {
|
|
|
1107
1071
|
comments?: K.CommentKind[] | null;
|
|
1108
1072
|
exact?: boolean;
|
|
1109
1073
|
indexers?: K.ObjectTypeIndexerKind[];
|
|
1074
|
+
inexact?: boolean | undefined;
|
|
1110
1075
|
internalSlots?: K.ObjectTypeInternalSlotKind[];
|
|
1111
1076
|
loc?: K.SourceLocationKind | null;
|
|
1112
1077
|
properties: (K.ObjectTypePropertyKind | K.ObjectTypeSpreadPropertyKind)[];
|
|
@@ -1283,13 +1248,13 @@ export interface TypeAliasBuilder {
|
|
|
1283
1248
|
}): N.TypeAlias;
|
|
1284
1249
|
}
|
|
1285
1250
|
export interface OpaqueTypeBuilder {
|
|
1286
|
-
(id: K.IdentifierKind, typeParameters: K.TypeParameterDeclarationKind | null): N.OpaqueType;
|
|
1251
|
+
(id: K.IdentifierKind, typeParameters: K.TypeParameterDeclarationKind | null, impltype: K.FlowTypeKind, supertype: K.FlowTypeKind): N.OpaqueType;
|
|
1287
1252
|
from(params: {
|
|
1288
1253
|
comments?: K.CommentKind[] | null;
|
|
1289
1254
|
id: K.IdentifierKind;
|
|
1290
|
-
|
|
1255
|
+
impltype: K.FlowTypeKind;
|
|
1291
1256
|
loc?: K.SourceLocationKind | null;
|
|
1292
|
-
|
|
1257
|
+
supertype: K.FlowTypeKind;
|
|
1293
1258
|
typeParameters: K.TypeParameterDeclarationKind | null;
|
|
1294
1259
|
}): N.OpaqueType;
|
|
1295
1260
|
}
|
|
@@ -2403,10 +2368,6 @@ export interface Builders {
|
|
|
2403
2368
|
spreadProperty: SpreadPropertyBuilder;
|
|
2404
2369
|
spreadPropertyPattern: SpreadPropertyPatternBuilder;
|
|
2405
2370
|
awaitExpression: AwaitExpressionBuilder;
|
|
2406
|
-
letStatement: LetStatementBuilder;
|
|
2407
|
-
letExpression: LetExpressionBuilder;
|
|
2408
|
-
graphExpression: GraphExpressionBuilder;
|
|
2409
|
-
graphIndexExpression: GraphIndexExpressionBuilder;
|
|
2410
2371
|
jsxAttribute: JSXAttributeBuilder;
|
|
2411
2372
|
jsxIdentifier: JSXIdentifierBuilder;
|
|
2412
2373
|
jsxNamespacedName: JSXNamespacedNameBuilder;
|
package/gen/kinds.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as N from "./nodes";
|
|
2
|
-
export declare type PrintableKind = N.File | N.Program | N.Identifier | N.BlockStatement | N.EmptyStatement | N.ExpressionStatement | N.IfStatement | N.LabeledStatement | N.BreakStatement | N.ContinueStatement | N.WithStatement | N.SwitchStatement | N.SwitchCase | N.ReturnStatement | N.ThrowStatement | N.TryStatement | N.CatchClause | N.WhileStatement | N.DoWhileStatement | N.ForStatement | N.VariableDeclaration | N.ForInStatement | N.DebuggerStatement | N.FunctionDeclaration | N.FunctionExpression | N.VariableDeclarator | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Property | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.RestElement | N.TypeAnnotation | N.TSTypeAnnotation | N.SpreadElementPattern | N.ArrowFunctionExpression | N.ForOfStatement | N.YieldExpression | N.GeneratorExpression | N.ComprehensionBlock | N.ComprehensionExpression | N.ObjectProperty | N.PropertyPattern | N.ObjectPattern | N.ArrayPattern | N.MethodDefinition | N.SpreadElement | N.AssignmentPattern | N.ClassPropertyDefinition | N.ClassProperty | N.ClassBody | N.ClassDeclaration | N.ClassExpression | N.ImportSpecifier | N.ImportNamespaceSpecifier | N.ImportDefaultSpecifier | N.ImportDeclaration | N.TaggedTemplateExpression | N.TemplateLiteral | N.TemplateElement | N.SpreadProperty | N.SpreadPropertyPattern | N.AwaitExpression | N.
|
|
2
|
+
export declare type PrintableKind = N.File | N.Program | N.Identifier | N.BlockStatement | N.EmptyStatement | N.ExpressionStatement | N.IfStatement | N.LabeledStatement | N.BreakStatement | N.ContinueStatement | N.WithStatement | N.SwitchStatement | N.SwitchCase | N.ReturnStatement | N.ThrowStatement | N.TryStatement | N.CatchClause | N.WhileStatement | N.DoWhileStatement | N.ForStatement | N.VariableDeclaration | N.ForInStatement | N.DebuggerStatement | N.FunctionDeclaration | N.FunctionExpression | N.VariableDeclarator | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Property | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.RestElement | N.TypeAnnotation | N.TSTypeAnnotation | N.SpreadElementPattern | N.ArrowFunctionExpression | N.ForOfStatement | N.YieldExpression | N.GeneratorExpression | N.ComprehensionBlock | N.ComprehensionExpression | N.ObjectProperty | N.PropertyPattern | N.ObjectPattern | N.ArrayPattern | N.MethodDefinition | N.SpreadElement | N.AssignmentPattern | N.ClassPropertyDefinition | N.ClassProperty | N.ClassBody | N.ClassDeclaration | N.ClassExpression | N.ImportSpecifier | N.ImportNamespaceSpecifier | N.ImportDefaultSpecifier | N.ImportDeclaration | N.TaggedTemplateExpression | N.TemplateLiteral | N.TemplateElement | N.SpreadProperty | N.SpreadPropertyPattern | N.AwaitExpression | N.JSXAttribute | N.JSXIdentifier | N.JSXNamespacedName | N.JSXExpressionContainer | N.JSXMemberExpression | N.JSXSpreadAttribute | N.JSXElement | N.JSXOpeningElement | N.JSXClosingElement | N.JSXFragment | N.JSXText | N.JSXOpeningFragment | N.JSXClosingFragment | N.JSXEmptyExpression | N.JSXSpreadChild | N.TypeParameterDeclaration | N.TSTypeParameterDeclaration | N.TypeParameterInstantiation | N.TSTypeParameterInstantiation | N.ClassImplements | N.TSExpressionWithTypeArguments | N.AnyTypeAnnotation | N.EmptyTypeAnnotation | N.MixedTypeAnnotation | N.VoidTypeAnnotation | N.NumberTypeAnnotation | N.NumberLiteralTypeAnnotation | N.NumericLiteralTypeAnnotation | N.StringTypeAnnotation | N.StringLiteralTypeAnnotation | N.BooleanTypeAnnotation | N.BooleanLiteralTypeAnnotation | N.NullableTypeAnnotation | N.NullLiteralTypeAnnotation | N.NullTypeAnnotation | N.ThisTypeAnnotation | N.ExistsTypeAnnotation | N.ExistentialTypeParam | N.FunctionTypeAnnotation | N.FunctionTypeParam | N.ArrayTypeAnnotation | N.ObjectTypeAnnotation | N.ObjectTypeProperty | N.ObjectTypeSpreadProperty | N.ObjectTypeIndexer | N.ObjectTypeCallProperty | N.ObjectTypeInternalSlot | N.Variance | N.QualifiedTypeIdentifier | N.GenericTypeAnnotation | N.MemberTypeAnnotation | N.UnionTypeAnnotation | N.IntersectionTypeAnnotation | N.TypeofTypeAnnotation | N.TypeParameter | N.InterfaceTypeAnnotation | N.InterfaceExtends | N.InterfaceDeclaration | N.DeclareInterface | N.TypeAlias | N.OpaqueType | N.DeclareTypeAlias | N.DeclareOpaqueType | N.TypeCastExpression | N.TupleTypeAnnotation | N.DeclareVariable | N.DeclareFunction | N.DeclareClass | N.DeclareModule | N.DeclareModuleExports | N.DeclareExportDeclaration | N.ExportSpecifier | N.ExportBatchSpecifier | N.DeclareExportAllDeclaration | N.InferredPredicate | N.DeclaredPredicate | N.ExportDeclaration | N.Block | N.Line | N.Noop | N.DoExpression | N.Super | N.BindExpression | N.Decorator | N.MetaProperty | N.ParenthesizedExpression | N.ExportDefaultDeclaration | N.ExportNamedDeclaration | N.ExportNamespaceSpecifier | N.ExportDefaultSpecifier | N.ExportAllDeclaration | N.CommentBlock | N.CommentLine | N.Directive | N.DirectiveLiteral | N.InterpreterDirective | N.StringLiteral | N.NumericLiteral | N.BigIntLiteral | N.NullLiteral | N.BooleanLiteral | N.RegExpLiteral | N.ObjectMethod | N.ClassPrivateProperty | N.ClassMethod | N.ClassPrivateMethod | N.PrivateName | N.RestProperty | N.ForAwaitStatement | N.Import | N.TSQualifiedName | N.TSTypeReference | N.TSAsExpression | N.TSNonNullExpression | N.TSAnyKeyword | N.TSBooleanKeyword | N.TSNeverKeyword | N.TSNullKeyword | N.TSNumberKeyword | N.TSObjectKeyword | N.TSStringKeyword | N.TSSymbolKeyword | N.TSUndefinedKeyword | N.TSUnknownKeyword | N.TSVoidKeyword | N.TSThisType | N.TSArrayType | N.TSLiteralType | N.TSUnionType | N.TSIntersectionType | N.TSConditionalType | N.TSInferType | N.TSTypeParameter | N.TSParenthesizedType | N.TSFunctionType | N.TSConstructorType | N.TSDeclareFunction | N.TSDeclareMethod | N.TSMappedType | N.TSTupleType | N.TSRestType | N.TSOptionalType | N.TSIndexedAccessType | N.TSTypeOperator | N.TSIndexSignature | N.TSPropertySignature | N.TSMethodSignature | N.TSTypePredicate | N.TSCallSignatureDeclaration | N.TSConstructSignatureDeclaration | N.TSEnumMember | N.TSTypeQuery | N.TSTypeLiteral | N.TSTypeAssertion | N.TSEnumDeclaration | N.TSTypeAliasDeclaration | N.TSModuleBlock | N.TSModuleDeclaration | N.TSImportEqualsDeclaration | N.TSExternalModuleReference | N.TSExportAssignment | N.TSNamespaceExportDeclaration | N.TSInterfaceBody | N.TSInterfaceDeclaration | N.TSParameterProperty | N.OptionalMemberExpression | N.OptionalCallExpression;
|
|
3
3
|
export declare type SourceLocationKind = N.SourceLocation;
|
|
4
|
-
export declare type NodeKind = N.File | N.Program | N.Identifier | N.BlockStatement | N.EmptyStatement | N.ExpressionStatement | N.IfStatement | N.LabeledStatement | N.BreakStatement | N.ContinueStatement | N.WithStatement | N.SwitchStatement | N.SwitchCase | N.ReturnStatement | N.ThrowStatement | N.TryStatement | N.CatchClause | N.WhileStatement | N.DoWhileStatement | N.ForStatement | N.VariableDeclaration | N.ForInStatement | N.DebuggerStatement | N.FunctionDeclaration | N.FunctionExpression | N.VariableDeclarator | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Property | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.RestElement | N.TypeAnnotation | N.TSTypeAnnotation | N.SpreadElementPattern | N.ArrowFunctionExpression | N.ForOfStatement | N.YieldExpression | N.GeneratorExpression | N.ComprehensionBlock | N.ComprehensionExpression | N.ObjectProperty | N.PropertyPattern | N.ObjectPattern | N.ArrayPattern | N.MethodDefinition | N.SpreadElement | N.AssignmentPattern | N.ClassPropertyDefinition | N.ClassProperty | N.ClassBody | N.ClassDeclaration | N.ClassExpression | N.ImportSpecifier | N.ImportNamespaceSpecifier | N.ImportDefaultSpecifier | N.ImportDeclaration | N.TaggedTemplateExpression | N.TemplateLiteral | N.TemplateElement | N.SpreadProperty | N.SpreadPropertyPattern | N.AwaitExpression | N.
|
|
4
|
+
export declare type NodeKind = N.File | N.Program | N.Identifier | N.BlockStatement | N.EmptyStatement | N.ExpressionStatement | N.IfStatement | N.LabeledStatement | N.BreakStatement | N.ContinueStatement | N.WithStatement | N.SwitchStatement | N.SwitchCase | N.ReturnStatement | N.ThrowStatement | N.TryStatement | N.CatchClause | N.WhileStatement | N.DoWhileStatement | N.ForStatement | N.VariableDeclaration | N.ForInStatement | N.DebuggerStatement | N.FunctionDeclaration | N.FunctionExpression | N.VariableDeclarator | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Property | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.RestElement | N.TypeAnnotation | N.TSTypeAnnotation | N.SpreadElementPattern | N.ArrowFunctionExpression | N.ForOfStatement | N.YieldExpression | N.GeneratorExpression | N.ComprehensionBlock | N.ComprehensionExpression | N.ObjectProperty | N.PropertyPattern | N.ObjectPattern | N.ArrayPattern | N.MethodDefinition | N.SpreadElement | N.AssignmentPattern | N.ClassPropertyDefinition | N.ClassProperty | N.ClassBody | N.ClassDeclaration | N.ClassExpression | N.ImportSpecifier | N.ImportNamespaceSpecifier | N.ImportDefaultSpecifier | N.ImportDeclaration | N.TaggedTemplateExpression | N.TemplateLiteral | N.TemplateElement | N.SpreadProperty | N.SpreadPropertyPattern | N.AwaitExpression | N.JSXAttribute | N.JSXIdentifier | N.JSXNamespacedName | N.JSXExpressionContainer | N.JSXMemberExpression | N.JSXSpreadAttribute | N.JSXElement | N.JSXOpeningElement | N.JSXClosingElement | N.JSXFragment | N.JSXText | N.JSXOpeningFragment | N.JSXClosingFragment | N.JSXEmptyExpression | N.JSXSpreadChild | N.TypeParameterDeclaration | N.TSTypeParameterDeclaration | N.TypeParameterInstantiation | N.TSTypeParameterInstantiation | N.ClassImplements | N.TSExpressionWithTypeArguments | N.AnyTypeAnnotation | N.EmptyTypeAnnotation | N.MixedTypeAnnotation | N.VoidTypeAnnotation | N.NumberTypeAnnotation | N.NumberLiteralTypeAnnotation | N.NumericLiteralTypeAnnotation | N.StringTypeAnnotation | N.StringLiteralTypeAnnotation | N.BooleanTypeAnnotation | N.BooleanLiteralTypeAnnotation | N.NullableTypeAnnotation | N.NullLiteralTypeAnnotation | N.NullTypeAnnotation | N.ThisTypeAnnotation | N.ExistsTypeAnnotation | N.ExistentialTypeParam | N.FunctionTypeAnnotation | N.FunctionTypeParam | N.ArrayTypeAnnotation | N.ObjectTypeAnnotation | N.ObjectTypeProperty | N.ObjectTypeSpreadProperty | N.ObjectTypeIndexer | N.ObjectTypeCallProperty | N.ObjectTypeInternalSlot | N.Variance | N.QualifiedTypeIdentifier | N.GenericTypeAnnotation | N.MemberTypeAnnotation | N.UnionTypeAnnotation | N.IntersectionTypeAnnotation | N.TypeofTypeAnnotation | N.TypeParameter | N.InterfaceTypeAnnotation | N.InterfaceExtends | N.InterfaceDeclaration | N.DeclareInterface | N.TypeAlias | N.OpaqueType | N.DeclareTypeAlias | N.DeclareOpaqueType | N.TypeCastExpression | N.TupleTypeAnnotation | N.DeclareVariable | N.DeclareFunction | N.DeclareClass | N.DeclareModule | N.DeclareModuleExports | N.DeclareExportDeclaration | N.ExportSpecifier | N.ExportBatchSpecifier | N.DeclareExportAllDeclaration | N.InferredPredicate | N.DeclaredPredicate | N.ExportDeclaration | N.Noop | N.DoExpression | N.Super | N.BindExpression | N.Decorator | N.MetaProperty | N.ParenthesizedExpression | N.ExportDefaultDeclaration | N.ExportNamedDeclaration | N.ExportNamespaceSpecifier | N.ExportDefaultSpecifier | N.ExportAllDeclaration | N.Directive | N.DirectiveLiteral | N.InterpreterDirective | N.StringLiteral | N.NumericLiteral | N.BigIntLiteral | N.NullLiteral | N.BooleanLiteral | N.RegExpLiteral | N.ObjectMethod | N.ClassPrivateProperty | N.ClassMethod | N.ClassPrivateMethod | N.PrivateName | N.RestProperty | N.ForAwaitStatement | N.Import | N.TSQualifiedName | N.TSTypeReference | N.TSAsExpression | N.TSNonNullExpression | N.TSAnyKeyword | N.TSBooleanKeyword | N.TSNeverKeyword | N.TSNullKeyword | N.TSNumberKeyword | N.TSObjectKeyword | N.TSStringKeyword | N.TSSymbolKeyword | N.TSUndefinedKeyword | N.TSUnknownKeyword | N.TSVoidKeyword | N.TSThisType | N.TSArrayType | N.TSLiteralType | N.TSUnionType | N.TSIntersectionType | N.TSConditionalType | N.TSInferType | N.TSTypeParameter | N.TSParenthesizedType | N.TSFunctionType | N.TSConstructorType | N.TSDeclareFunction | N.TSDeclareMethod | N.TSMappedType | N.TSTupleType | N.TSRestType | N.TSOptionalType | N.TSIndexedAccessType | N.TSTypeOperator | N.TSIndexSignature | N.TSPropertySignature | N.TSMethodSignature | N.TSTypePredicate | N.TSCallSignatureDeclaration | N.TSConstructSignatureDeclaration | N.TSEnumMember | N.TSTypeQuery | N.TSTypeLiteral | N.TSTypeAssertion | N.TSEnumDeclaration | N.TSTypeAliasDeclaration | N.TSModuleBlock | N.TSModuleDeclaration | N.TSImportEqualsDeclaration | N.TSExternalModuleReference | N.TSExportAssignment | N.TSNamespaceExportDeclaration | N.TSInterfaceBody | N.TSInterfaceDeclaration | N.TSParameterProperty | N.OptionalMemberExpression | N.OptionalCallExpression;
|
|
5
5
|
export declare type CommentKind = N.Block | N.Line | N.CommentBlock | N.CommentLine;
|
|
6
6
|
export declare type PositionKind = N.Position;
|
|
7
7
|
export declare type FileKind = N.File;
|
|
8
8
|
export declare type ProgramKind = N.Program;
|
|
9
|
-
export declare type StatementKind = N.BlockStatement | N.EmptyStatement | N.ExpressionStatement | N.IfStatement | N.LabeledStatement | N.BreakStatement | N.ContinueStatement | N.WithStatement | N.SwitchStatement | N.ReturnStatement | N.ThrowStatement | N.TryStatement | N.WhileStatement | N.DoWhileStatement | N.ForStatement | N.VariableDeclaration | N.ForInStatement | N.DebuggerStatement | N.FunctionDeclaration | N.ForOfStatement | N.MethodDefinition | N.ClassPropertyDefinition | N.ClassProperty | N.ClassBody | N.ClassDeclaration | N.ImportDeclaration | N.
|
|
9
|
+
export declare type StatementKind = N.BlockStatement | N.EmptyStatement | N.ExpressionStatement | N.IfStatement | N.LabeledStatement | N.BreakStatement | N.ContinueStatement | N.WithStatement | N.SwitchStatement | N.ReturnStatement | N.ThrowStatement | N.TryStatement | N.WhileStatement | N.DoWhileStatement | N.ForStatement | N.VariableDeclaration | N.ForInStatement | N.DebuggerStatement | N.FunctionDeclaration | N.ForOfStatement | N.MethodDefinition | N.ClassPropertyDefinition | N.ClassProperty | N.ClassBody | N.ClassDeclaration | N.ImportDeclaration | N.TSTypeParameterDeclaration | N.InterfaceDeclaration | N.DeclareInterface | N.TypeAlias | N.OpaqueType | N.DeclareTypeAlias | N.DeclareOpaqueType | N.DeclareVariable | N.DeclareFunction | N.DeclareClass | N.DeclareModule | N.DeclareModuleExports | N.DeclareExportDeclaration | N.DeclareExportAllDeclaration | N.ExportDeclaration | N.Noop | N.ExportDefaultDeclaration | N.ExportNamedDeclaration | N.ExportAllDeclaration | N.ClassPrivateProperty | N.ClassMethod | N.ClassPrivateMethod | N.ForAwaitStatement | N.TSDeclareFunction | N.TSDeclareMethod | N.TSIndexSignature | N.TSPropertySignature | N.TSMethodSignature | N.TSCallSignatureDeclaration | N.TSConstructSignatureDeclaration | N.TSEnumDeclaration | N.TSTypeAliasDeclaration | N.TSModuleDeclaration | N.TSImportEqualsDeclaration | N.TSExternalModuleReference | N.TSExportAssignment | N.TSNamespaceExportDeclaration | N.TSInterfaceDeclaration;
|
|
10
10
|
export declare type FunctionKind = N.FunctionDeclaration | N.FunctionExpression | N.ArrowFunctionExpression | N.ObjectMethod | N.ClassMethod | N.ClassPrivateMethod;
|
|
11
|
-
export declare type PatternKind = N.Identifier | N.FunctionExpression | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.RestElement | N.SpreadElementPattern | N.ArrowFunctionExpression | N.YieldExpression | N.GeneratorExpression | N.ComprehensionExpression | N.PropertyPattern | N.ObjectPattern | N.ArrayPattern | N.AssignmentPattern | N.ClassExpression | N.TaggedTemplateExpression | N.TemplateLiteral | N.SpreadPropertyPattern | N.AwaitExpression | N.
|
|
12
|
-
export declare type ExpressionKind = N.Identifier | N.FunctionExpression | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.ArrowFunctionExpression | N.YieldExpression | N.GeneratorExpression | N.ComprehensionExpression | N.ClassExpression | N.TaggedTemplateExpression | N.TemplateLiteral | N.AwaitExpression | N.
|
|
11
|
+
export declare type PatternKind = N.Identifier | N.FunctionExpression | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.RestElement | N.SpreadElementPattern | N.ArrowFunctionExpression | N.YieldExpression | N.GeneratorExpression | N.ComprehensionExpression | N.PropertyPattern | N.ObjectPattern | N.ArrayPattern | N.AssignmentPattern | N.ClassExpression | N.TaggedTemplateExpression | N.TemplateLiteral | N.SpreadPropertyPattern | N.AwaitExpression | N.JSXIdentifier | N.JSXExpressionContainer | N.JSXMemberExpression | N.JSXElement | N.JSXFragment | N.JSXText | N.JSXEmptyExpression | N.JSXSpreadChild | N.TypeCastExpression | N.DoExpression | N.Super | N.BindExpression | N.MetaProperty | N.ParenthesizedExpression | N.DirectiveLiteral | N.StringLiteral | N.NumericLiteral | N.BigIntLiteral | N.NullLiteral | N.BooleanLiteral | N.RegExpLiteral | N.PrivateName | N.Import | N.TSAsExpression | N.TSNonNullExpression | N.TSTypeParameter | N.TSTypeAssertion | N.TSParameterProperty | N.OptionalMemberExpression | N.OptionalCallExpression;
|
|
12
|
+
export declare type ExpressionKind = N.Identifier | N.FunctionExpression | N.ThisExpression | N.ArrayExpression | N.ObjectExpression | N.Literal | N.SequenceExpression | N.UnaryExpression | N.BinaryExpression | N.AssignmentExpression | N.UpdateExpression | N.LogicalExpression | N.ConditionalExpression | N.NewExpression | N.CallExpression | N.MemberExpression | N.ArrowFunctionExpression | N.YieldExpression | N.GeneratorExpression | N.ComprehensionExpression | N.ClassExpression | N.TaggedTemplateExpression | N.TemplateLiteral | N.AwaitExpression | N.JSXIdentifier | N.JSXExpressionContainer | N.JSXMemberExpression | N.JSXElement | N.JSXFragment | N.JSXText | N.JSXEmptyExpression | N.JSXSpreadChild | N.TypeCastExpression | N.DoExpression | N.Super | N.BindExpression | N.MetaProperty | N.ParenthesizedExpression | N.DirectiveLiteral | N.StringLiteral | N.NumericLiteral | N.BigIntLiteral | N.NullLiteral | N.BooleanLiteral | N.RegExpLiteral | N.PrivateName | N.Import | N.TSAsExpression | N.TSNonNullExpression | N.TSTypeParameter | N.TSTypeAssertion | N.OptionalMemberExpression | N.OptionalCallExpression;
|
|
13
13
|
export declare type IdentifierKind = N.Identifier | N.JSXIdentifier | N.TSTypeParameter;
|
|
14
14
|
export declare type BlockStatementKind = N.BlockStatement;
|
|
15
15
|
export declare type EmptyStatementKind = N.EmptyStatement;
|
|
@@ -84,29 +84,6 @@ export declare type TemplateElementKind = N.TemplateElement;
|
|
|
84
84
|
export declare type SpreadPropertyKind = N.SpreadProperty;
|
|
85
85
|
export declare type SpreadPropertyPatternKind = N.SpreadPropertyPattern;
|
|
86
86
|
export declare type AwaitExpressionKind = N.AwaitExpression;
|
|
87
|
-
export declare type LetStatementKind = N.LetStatement;
|
|
88
|
-
export declare type LetExpressionKind = N.LetExpression;
|
|
89
|
-
export declare type GraphExpressionKind = N.GraphExpression;
|
|
90
|
-
export declare type GraphIndexExpressionKind = N.GraphIndexExpression;
|
|
91
|
-
export declare type XMLDefaultDeclarationKind = N.XMLDefaultDeclaration;
|
|
92
|
-
export declare type XMLAnyNameKind = N.XMLAnyName;
|
|
93
|
-
export declare type XMLQualifiedIdentifierKind = N.XMLQualifiedIdentifier;
|
|
94
|
-
export declare type XMLFunctionQualifiedIdentifierKind = N.XMLFunctionQualifiedIdentifier;
|
|
95
|
-
export declare type XMLAttributeSelectorKind = N.XMLAttributeSelector;
|
|
96
|
-
export declare type XMLFilterExpressionKind = N.XMLFilterExpression;
|
|
97
|
-
export declare type XMLKind = N.XML;
|
|
98
|
-
export declare type XMLElementKind = N.XMLElement;
|
|
99
|
-
export declare type XMLListKind = N.XMLList;
|
|
100
|
-
export declare type XMLEscapeKind = N.XMLEscape;
|
|
101
|
-
export declare type XMLTextKind = N.XMLText;
|
|
102
|
-
export declare type XMLStartTagKind = N.XMLStartTag;
|
|
103
|
-
export declare type XMLEndTagKind = N.XMLEndTag;
|
|
104
|
-
export declare type XMLPointTagKind = N.XMLPointTag;
|
|
105
|
-
export declare type XMLNameKind = N.XMLName;
|
|
106
|
-
export declare type XMLAttributeKind = N.XMLAttribute;
|
|
107
|
-
export declare type XMLCdataKind = N.XMLCdata;
|
|
108
|
-
export declare type XMLCommentKind = N.XMLComment;
|
|
109
|
-
export declare type XMLProcessingInstructionKind = N.XMLProcessingInstruction;
|
|
110
87
|
export declare type JSXAttributeKind = N.JSXAttribute;
|
|
111
88
|
export declare type JSXIdentifierKind = N.JSXIdentifier;
|
|
112
89
|
export declare type JSXNamespacedNameKind = N.JSXNamespacedName;
|
package/gen/namedTypes.d.ts
CHANGED
|
@@ -86,29 +86,6 @@ export interface NamedTypes {
|
|
|
86
86
|
SpreadProperty: Type<N.SpreadProperty>;
|
|
87
87
|
SpreadPropertyPattern: Type<N.SpreadPropertyPattern>;
|
|
88
88
|
AwaitExpression: Type<N.AwaitExpression>;
|
|
89
|
-
LetStatement: Type<N.LetStatement>;
|
|
90
|
-
LetExpression: Type<N.LetExpression>;
|
|
91
|
-
GraphExpression: Type<N.GraphExpression>;
|
|
92
|
-
GraphIndexExpression: Type<N.GraphIndexExpression>;
|
|
93
|
-
XMLDefaultDeclaration: Type<N.XMLDefaultDeclaration>;
|
|
94
|
-
XMLAnyName: Type<N.XMLAnyName>;
|
|
95
|
-
XMLQualifiedIdentifier: Type<N.XMLQualifiedIdentifier>;
|
|
96
|
-
XMLFunctionQualifiedIdentifier: Type<N.XMLFunctionQualifiedIdentifier>;
|
|
97
|
-
XMLAttributeSelector: Type<N.XMLAttributeSelector>;
|
|
98
|
-
XMLFilterExpression: Type<N.XMLFilterExpression>;
|
|
99
|
-
XML: Type<N.XML>;
|
|
100
|
-
XMLElement: Type<N.XMLElement>;
|
|
101
|
-
XMLList: Type<N.XMLList>;
|
|
102
|
-
XMLEscape: Type<N.XMLEscape>;
|
|
103
|
-
XMLText: Type<N.XMLText>;
|
|
104
|
-
XMLStartTag: Type<N.XMLStartTag>;
|
|
105
|
-
XMLEndTag: Type<N.XMLEndTag>;
|
|
106
|
-
XMLPointTag: Type<N.XMLPointTag>;
|
|
107
|
-
XMLName: Type<N.XMLName>;
|
|
108
|
-
XMLAttribute: Type<N.XMLAttribute>;
|
|
109
|
-
XMLCdata: Type<N.XMLCdata>;
|
|
110
|
-
XMLComment: Type<N.XMLComment>;
|
|
111
|
-
XMLProcessingInstruction: Type<N.XMLProcessingInstruction>;
|
|
112
89
|
JSXAttribute: Type<N.JSXAttribute>;
|
|
113
90
|
JSXIdentifier: Type<N.JSXIdentifier>;
|
|
114
91
|
JSXNamespacedName: Type<N.JSXNamespacedName>;
|
package/gen/nodes.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface Statement extends Node {
|
|
|
37
37
|
export interface Function extends Node {
|
|
38
38
|
id: K.IdentifierKind | null;
|
|
39
39
|
params: K.PatternKind[];
|
|
40
|
-
body: K.BlockStatementKind
|
|
40
|
+
body: K.BlockStatementKind;
|
|
41
41
|
generator: boolean;
|
|
42
42
|
async: boolean;
|
|
43
43
|
expression: boolean;
|
|
@@ -154,7 +154,6 @@ export interface ForInStatement extends Omit<Statement, "type"> {
|
|
|
154
154
|
left: K.VariableDeclarationKind | K.ExpressionKind;
|
|
155
155
|
right: K.ExpressionKind;
|
|
156
156
|
body: K.StatementKind;
|
|
157
|
-
each: boolean;
|
|
158
157
|
}
|
|
159
158
|
export interface DebuggerStatement extends Omit<Statement, "type"> {
|
|
160
159
|
type: "DebuggerStatement";
|
|
@@ -439,85 +438,6 @@ export interface AwaitExpression extends Omit<Expression, "type"> {
|
|
|
439
438
|
argument: K.ExpressionKind | null;
|
|
440
439
|
all: boolean;
|
|
441
440
|
}
|
|
442
|
-
export interface LetStatement extends Omit<Statement, "type"> {
|
|
443
|
-
type: "LetStatement";
|
|
444
|
-
head: K.VariableDeclaratorKind[];
|
|
445
|
-
body: K.StatementKind;
|
|
446
|
-
}
|
|
447
|
-
export interface LetExpression extends Omit<Expression, "type"> {
|
|
448
|
-
type: "LetExpression";
|
|
449
|
-
head: K.VariableDeclaratorKind[];
|
|
450
|
-
body: K.ExpressionKind;
|
|
451
|
-
}
|
|
452
|
-
export interface GraphExpression extends Omit<Expression, "type"> {
|
|
453
|
-
type: "GraphExpression";
|
|
454
|
-
index: number;
|
|
455
|
-
expression: K.LiteralKind;
|
|
456
|
-
}
|
|
457
|
-
export interface GraphIndexExpression extends Omit<Expression, "type"> {
|
|
458
|
-
type: "GraphIndexExpression";
|
|
459
|
-
index: number;
|
|
460
|
-
}
|
|
461
|
-
export interface XMLDefaultDeclaration extends Declaration {
|
|
462
|
-
namespace: K.ExpressionKind;
|
|
463
|
-
}
|
|
464
|
-
export interface XMLAnyName extends Expression {
|
|
465
|
-
}
|
|
466
|
-
export interface XMLQualifiedIdentifier extends Expression {
|
|
467
|
-
left: K.IdentifierKind | K.XMLAnyNameKind;
|
|
468
|
-
right: K.IdentifierKind | K.ExpressionKind;
|
|
469
|
-
computed: boolean;
|
|
470
|
-
}
|
|
471
|
-
export interface XMLFunctionQualifiedIdentifier extends Expression {
|
|
472
|
-
right: K.IdentifierKind | K.ExpressionKind;
|
|
473
|
-
computed: boolean;
|
|
474
|
-
}
|
|
475
|
-
export interface XMLAttributeSelector extends Expression {
|
|
476
|
-
attribute: K.ExpressionKind;
|
|
477
|
-
}
|
|
478
|
-
export interface XMLFilterExpression extends Expression {
|
|
479
|
-
left: K.ExpressionKind;
|
|
480
|
-
right: K.ExpressionKind;
|
|
481
|
-
}
|
|
482
|
-
export interface XML extends Node {
|
|
483
|
-
}
|
|
484
|
-
export interface XMLElement extends XML, Expression {
|
|
485
|
-
contents: K.XMLKind[];
|
|
486
|
-
}
|
|
487
|
-
export interface XMLList extends XML, Expression {
|
|
488
|
-
contents: K.XMLKind[];
|
|
489
|
-
}
|
|
490
|
-
export interface XMLEscape extends XML {
|
|
491
|
-
expression: K.ExpressionKind;
|
|
492
|
-
}
|
|
493
|
-
export interface XMLText extends XML {
|
|
494
|
-
text: string;
|
|
495
|
-
}
|
|
496
|
-
export interface XMLStartTag extends XML {
|
|
497
|
-
contents: K.XMLKind[];
|
|
498
|
-
}
|
|
499
|
-
export interface XMLEndTag extends XML {
|
|
500
|
-
contents: K.XMLKind[];
|
|
501
|
-
}
|
|
502
|
-
export interface XMLPointTag extends XML {
|
|
503
|
-
contents: K.XMLKind[];
|
|
504
|
-
}
|
|
505
|
-
export interface XMLName extends XML {
|
|
506
|
-
contents: string | K.XMLKind[];
|
|
507
|
-
}
|
|
508
|
-
export interface XMLAttribute extends XML {
|
|
509
|
-
value: string;
|
|
510
|
-
}
|
|
511
|
-
export interface XMLCdata extends XML {
|
|
512
|
-
contents: string;
|
|
513
|
-
}
|
|
514
|
-
export interface XMLComment extends XML {
|
|
515
|
-
contents: string;
|
|
516
|
-
}
|
|
517
|
-
export interface XMLProcessingInstruction extends XML {
|
|
518
|
-
target: string;
|
|
519
|
-
contents: string | null;
|
|
520
|
-
}
|
|
521
441
|
export interface JSXAttribute extends Omit<Node, "type"> {
|
|
522
442
|
type: "JSXAttribute";
|
|
523
443
|
name: K.JSXIdentifierKind | K.JSXNamespacedNameKind;
|
|
@@ -703,6 +623,7 @@ export interface ObjectTypeAnnotation extends Omit<FlowType, "type"> {
|
|
|
703
623
|
properties: (K.ObjectTypePropertyKind | K.ObjectTypeSpreadPropertyKind)[];
|
|
704
624
|
indexers: K.ObjectTypeIndexerKind[];
|
|
705
625
|
callProperties: K.ObjectTypeCallPropertyKind[];
|
|
626
|
+
inexact: boolean | undefined;
|
|
706
627
|
exact: boolean;
|
|
707
628
|
internalSlots: K.ObjectTypeInternalSlotKind[];
|
|
708
629
|
}
|
|
@@ -804,8 +725,8 @@ export interface OpaqueType extends Omit<Declaration, "type"> {
|
|
|
804
725
|
type: "OpaqueType";
|
|
805
726
|
id: K.IdentifierKind;
|
|
806
727
|
typeParameters: K.TypeParameterDeclarationKind | null;
|
|
807
|
-
|
|
808
|
-
|
|
728
|
+
impltype: K.FlowTypeKind;
|
|
729
|
+
supertype: K.FlowTypeKind;
|
|
809
730
|
}
|
|
810
731
|
export interface DeclareTypeAlias extends Omit<TypeAlias, "type"> {
|
|
811
732
|
type: "DeclareTypeAlias";
|
|
@@ -1331,4 +1252,4 @@ export interface OptionalCallExpression extends Omit<CallExpression, "type"> {
|
|
|
1331
1252
|
type: "OptionalCallExpression";
|
|
1332
1253
|
optional: boolean;
|
|
1333
1254
|
}
|
|
1334
|
-
export declare type ASTNode = File | Program | Identifier | BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | LabeledStatement | BreakStatement | ContinueStatement | WithStatement | SwitchStatement | SwitchCase | ReturnStatement | ThrowStatement | TryStatement | CatchClause | WhileStatement | DoWhileStatement | ForStatement | VariableDeclaration | ForInStatement | DebuggerStatement | FunctionDeclaration | FunctionExpression | VariableDeclarator | ThisExpression | ArrayExpression | ObjectExpression | Property | Literal | SequenceExpression | UnaryExpression | BinaryExpression | AssignmentExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | MemberExpression | RestElement | TypeAnnotation | TSTypeAnnotation | SpreadElementPattern | ArrowFunctionExpression | ForOfStatement | YieldExpression | GeneratorExpression | ComprehensionBlock | ComprehensionExpression | ObjectProperty | PropertyPattern | ObjectPattern | ArrayPattern | MethodDefinition | SpreadElement | AssignmentPattern | ClassPropertyDefinition | ClassProperty | ClassBody | ClassDeclaration | ClassExpression | ImportSpecifier | ImportNamespaceSpecifier | ImportDefaultSpecifier | ImportDeclaration | TaggedTemplateExpression | TemplateLiteral | TemplateElement | SpreadProperty | SpreadPropertyPattern | AwaitExpression |
|
|
1255
|
+
export declare type ASTNode = File | Program | Identifier | BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | LabeledStatement | BreakStatement | ContinueStatement | WithStatement | SwitchStatement | SwitchCase | ReturnStatement | ThrowStatement | TryStatement | CatchClause | WhileStatement | DoWhileStatement | ForStatement | VariableDeclaration | ForInStatement | DebuggerStatement | FunctionDeclaration | FunctionExpression | VariableDeclarator | ThisExpression | ArrayExpression | ObjectExpression | Property | Literal | SequenceExpression | UnaryExpression | BinaryExpression | AssignmentExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | MemberExpression | RestElement | TypeAnnotation | TSTypeAnnotation | SpreadElementPattern | ArrowFunctionExpression | ForOfStatement | YieldExpression | GeneratorExpression | ComprehensionBlock | ComprehensionExpression | ObjectProperty | PropertyPattern | ObjectPattern | ArrayPattern | MethodDefinition | SpreadElement | AssignmentPattern | ClassPropertyDefinition | ClassProperty | ClassBody | ClassDeclaration | ClassExpression | ImportSpecifier | ImportNamespaceSpecifier | ImportDefaultSpecifier | ImportDeclaration | TaggedTemplateExpression | TemplateLiteral | TemplateElement | SpreadProperty | SpreadPropertyPattern | AwaitExpression | JSXAttribute | JSXIdentifier | JSXNamespacedName | JSXExpressionContainer | JSXMemberExpression | JSXSpreadAttribute | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXText | JSXOpeningFragment | JSXClosingFragment | JSXEmptyExpression | JSXSpreadChild | TypeParameterDeclaration | TSTypeParameterDeclaration | TypeParameterInstantiation | TSTypeParameterInstantiation | ClassImplements | TSExpressionWithTypeArguments | AnyTypeAnnotation | EmptyTypeAnnotation | MixedTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | NumberLiteralTypeAnnotation | NumericLiteralTypeAnnotation | StringTypeAnnotation | StringLiteralTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullableTypeAnnotation | NullLiteralTypeAnnotation | NullTypeAnnotation | ThisTypeAnnotation | ExistsTypeAnnotation | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam | ArrayTypeAnnotation | ObjectTypeAnnotation | ObjectTypeProperty | ObjectTypeSpreadProperty | ObjectTypeIndexer | ObjectTypeCallProperty | ObjectTypeInternalSlot | Variance | QualifiedTypeIdentifier | GenericTypeAnnotation | MemberTypeAnnotation | UnionTypeAnnotation | IntersectionTypeAnnotation | TypeofTypeAnnotation | TypeParameter | InterfaceTypeAnnotation | InterfaceExtends | InterfaceDeclaration | DeclareInterface | TypeAlias | OpaqueType | DeclareTypeAlias | DeclareOpaqueType | TypeCastExpression | TupleTypeAnnotation | DeclareVariable | DeclareFunction | DeclareClass | DeclareModule | DeclareModuleExports | DeclareExportDeclaration | ExportSpecifier | ExportBatchSpecifier | DeclareExportAllDeclaration | InferredPredicate | DeclaredPredicate | ExportDeclaration | Block | Line | Noop | DoExpression | Super | BindExpression | Decorator | MetaProperty | ParenthesizedExpression | ExportDefaultDeclaration | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportDefaultSpecifier | ExportAllDeclaration | CommentBlock | CommentLine | Directive | DirectiveLiteral | InterpreterDirective | StringLiteral | NumericLiteral | BigIntLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ObjectMethod | ClassPrivateProperty | ClassMethod | ClassPrivateMethod | PrivateName | RestProperty | ForAwaitStatement | Import | TSQualifiedName | TSTypeReference | TSAsExpression | TSNonNullExpression | TSAnyKeyword | TSBooleanKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSArrayType | TSLiteralType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSTypeParameter | TSParenthesizedType | TSFunctionType | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSMappedType | TSTupleType | TSRestType | TSOptionalType | TSIndexedAccessType | TSTypeOperator | TSIndexSignature | TSPropertySignature | TSMethodSignature | TSTypePredicate | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSEnumMember | TSTypeQuery | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;
|
package/gen/visitor.d.ts
CHANGED
|
@@ -87,29 +87,6 @@ export interface Visitor<M = {}> {
|
|
|
87
87
|
visitSpreadProperty?(this: Context & M, path: NodePath<N.SpreadProperty>): any;
|
|
88
88
|
visitSpreadPropertyPattern?(this: Context & M, path: NodePath<N.SpreadPropertyPattern>): any;
|
|
89
89
|
visitAwaitExpression?(this: Context & M, path: NodePath<N.AwaitExpression>): any;
|
|
90
|
-
visitLetStatement?(this: Context & M, path: NodePath<N.LetStatement>): any;
|
|
91
|
-
visitLetExpression?(this: Context & M, path: NodePath<N.LetExpression>): any;
|
|
92
|
-
visitGraphExpression?(this: Context & M, path: NodePath<N.GraphExpression>): any;
|
|
93
|
-
visitGraphIndexExpression?(this: Context & M, path: NodePath<N.GraphIndexExpression>): any;
|
|
94
|
-
visitXMLDefaultDeclaration?(this: Context & M, path: NodePath<N.XMLDefaultDeclaration>): any;
|
|
95
|
-
visitXMLAnyName?(this: Context & M, path: NodePath<N.XMLAnyName>): any;
|
|
96
|
-
visitXMLQualifiedIdentifier?(this: Context & M, path: NodePath<N.XMLQualifiedIdentifier>): any;
|
|
97
|
-
visitXMLFunctionQualifiedIdentifier?(this: Context & M, path: NodePath<N.XMLFunctionQualifiedIdentifier>): any;
|
|
98
|
-
visitXMLAttributeSelector?(this: Context & M, path: NodePath<N.XMLAttributeSelector>): any;
|
|
99
|
-
visitXMLFilterExpression?(this: Context & M, path: NodePath<N.XMLFilterExpression>): any;
|
|
100
|
-
visitXML?(this: Context & M, path: NodePath<N.XML>): any;
|
|
101
|
-
visitXMLElement?(this: Context & M, path: NodePath<N.XMLElement>): any;
|
|
102
|
-
visitXMLList?(this: Context & M, path: NodePath<N.XMLList>): any;
|
|
103
|
-
visitXMLEscape?(this: Context & M, path: NodePath<N.XMLEscape>): any;
|
|
104
|
-
visitXMLText?(this: Context & M, path: NodePath<N.XMLText>): any;
|
|
105
|
-
visitXMLStartTag?(this: Context & M, path: NodePath<N.XMLStartTag>): any;
|
|
106
|
-
visitXMLEndTag?(this: Context & M, path: NodePath<N.XMLEndTag>): any;
|
|
107
|
-
visitXMLPointTag?(this: Context & M, path: NodePath<N.XMLPointTag>): any;
|
|
108
|
-
visitXMLName?(this: Context & M, path: NodePath<N.XMLName>): any;
|
|
109
|
-
visitXMLAttribute?(this: Context & M, path: NodePath<N.XMLAttribute>): any;
|
|
110
|
-
visitXMLCdata?(this: Context & M, path: NodePath<N.XMLCdata>): any;
|
|
111
|
-
visitXMLComment?(this: Context & M, path: NodePath<N.XMLComment>): any;
|
|
112
|
-
visitXMLProcessingInstruction?(this: Context & M, path: NodePath<N.XMLProcessingInstruction>): any;
|
|
113
90
|
visitJSXAttribute?(this: Context & M, path: NodePath<N.JSXAttribute>): any;
|
|
114
91
|
visitJSXIdentifier?(this: Context & M, path: NodePath<N.JSXIdentifier>): any;
|
|
115
92
|
visitJSXNamespacedName?(this: Context & M, path: NodePath<N.JSXNamespacedName>): any;
|
package/main.js
CHANGED
|
@@ -7,8 +7,6 @@ var fork_1 = __importDefault(require("./fork"));
|
|
|
7
7
|
var core_1 = __importDefault(require("./def/core"));
|
|
8
8
|
var es6_1 = __importDefault(require("./def/es6"));
|
|
9
9
|
var es7_1 = __importDefault(require("./def/es7"));
|
|
10
|
-
var mozilla_1 = __importDefault(require("./def/mozilla"));
|
|
11
|
-
var e4x_1 = __importDefault(require("./def/e4x"));
|
|
12
10
|
var jsx_1 = __importDefault(require("./def/jsx"));
|
|
13
11
|
var flow_1 = __importDefault(require("./def/flow"));
|
|
14
12
|
var esprima_1 = __importDefault(require("./def/esprima"));
|
|
@@ -23,8 +21,6 @@ var defs = [
|
|
|
23
21
|
// configure the precise type hierarchy that you need.
|
|
24
22
|
es6_1.default,
|
|
25
23
|
es7_1.default,
|
|
26
|
-
mozilla_1.default,
|
|
27
|
-
e4x_1.default,
|
|
28
24
|
jsx_1.default,
|
|
29
25
|
flow_1.default,
|
|
30
26
|
esprima_1.default,
|
package/package.json
CHANGED
package/def/e4x.d.ts
DELETED
package/def/e4x.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var types_1 = __importDefault(require("../lib/types"));
|
|
7
|
-
var core_1 = __importDefault(require("./core"));
|
|
8
|
-
function default_1(fork) {
|
|
9
|
-
fork.use(core_1.default);
|
|
10
|
-
var types = fork.use(types_1.default);
|
|
11
|
-
var def = types.Type.def;
|
|
12
|
-
var or = types.Type.or;
|
|
13
|
-
// Note that none of these types are buildable because the Mozilla Parser
|
|
14
|
-
// API doesn't specify any builder functions, and nobody uses E4X anymore.
|
|
15
|
-
def("XMLDefaultDeclaration")
|
|
16
|
-
.bases("Declaration")
|
|
17
|
-
.field("namespace", def("Expression"));
|
|
18
|
-
def("XMLAnyName").bases("Expression");
|
|
19
|
-
def("XMLQualifiedIdentifier")
|
|
20
|
-
.bases("Expression")
|
|
21
|
-
.field("left", or(def("Identifier"), def("XMLAnyName")))
|
|
22
|
-
.field("right", or(def("Identifier"), def("Expression")))
|
|
23
|
-
.field("computed", Boolean);
|
|
24
|
-
def("XMLFunctionQualifiedIdentifier")
|
|
25
|
-
.bases("Expression")
|
|
26
|
-
.field("right", or(def("Identifier"), def("Expression")))
|
|
27
|
-
.field("computed", Boolean);
|
|
28
|
-
def("XMLAttributeSelector")
|
|
29
|
-
.bases("Expression")
|
|
30
|
-
.field("attribute", def("Expression"));
|
|
31
|
-
def("XMLFilterExpression")
|
|
32
|
-
.bases("Expression")
|
|
33
|
-
.field("left", def("Expression"))
|
|
34
|
-
.field("right", def("Expression"));
|
|
35
|
-
def("XMLElement")
|
|
36
|
-
.bases("XML", "Expression")
|
|
37
|
-
.field("contents", [def("XML")]);
|
|
38
|
-
def("XMLList")
|
|
39
|
-
.bases("XML", "Expression")
|
|
40
|
-
.field("contents", [def("XML")]);
|
|
41
|
-
def("XML").bases("Node");
|
|
42
|
-
def("XMLEscape")
|
|
43
|
-
.bases("XML")
|
|
44
|
-
.field("expression", def("Expression"));
|
|
45
|
-
def("XMLText")
|
|
46
|
-
.bases("XML")
|
|
47
|
-
.field("text", String);
|
|
48
|
-
def("XMLStartTag")
|
|
49
|
-
.bases("XML")
|
|
50
|
-
.field("contents", [def("XML")]);
|
|
51
|
-
def("XMLEndTag")
|
|
52
|
-
.bases("XML")
|
|
53
|
-
.field("contents", [def("XML")]);
|
|
54
|
-
def("XMLPointTag")
|
|
55
|
-
.bases("XML")
|
|
56
|
-
.field("contents", [def("XML")]);
|
|
57
|
-
def("XMLName")
|
|
58
|
-
.bases("XML")
|
|
59
|
-
.field("contents", or(String, [def("XML")]));
|
|
60
|
-
def("XMLAttribute")
|
|
61
|
-
.bases("XML")
|
|
62
|
-
.field("value", String);
|
|
63
|
-
def("XMLCdata")
|
|
64
|
-
.bases("XML")
|
|
65
|
-
.field("contents", String);
|
|
66
|
-
def("XMLComment")
|
|
67
|
-
.bases("XML")
|
|
68
|
-
.field("contents", String);
|
|
69
|
-
def("XMLProcessingInstruction")
|
|
70
|
-
.bases("XML")
|
|
71
|
-
.field("target", String)
|
|
72
|
-
.field("contents", or(String, null));
|
|
73
|
-
}
|
|
74
|
-
exports.default = default_1;
|
|
75
|
-
module.exports = exports["default"];
|
package/def/mozilla.d.ts
DELETED
package/def/mozilla.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";;
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var core_1 = __importDefault(require("./core"));
|
|
7
|
-
var types_1 = __importDefault(require("../lib/types"));
|
|
8
|
-
var shared_1 = __importDefault(require("../lib/shared"));
|
|
9
|
-
function default_1(fork) {
|
|
10
|
-
fork.use(core_1.default);
|
|
11
|
-
var types = fork.use(types_1.default);
|
|
12
|
-
var def = types.Type.def;
|
|
13
|
-
var or = types.Type.or;
|
|
14
|
-
var shared = fork.use(shared_1.default);
|
|
15
|
-
var geq = shared.geq;
|
|
16
|
-
var defaults = shared.defaults;
|
|
17
|
-
def("Function")
|
|
18
|
-
// SpiderMonkey allows expression closures: function(x) x+1
|
|
19
|
-
.field("body", or(def("BlockStatement"), def("Expression")));
|
|
20
|
-
def("ForInStatement")
|
|
21
|
-
.build("left", "right", "body", "each")
|
|
22
|
-
.field("each", Boolean, defaults["false"]);
|
|
23
|
-
def("LetStatement")
|
|
24
|
-
.bases("Statement")
|
|
25
|
-
.build("head", "body")
|
|
26
|
-
// TODO Deviating from the spec by reusing VariableDeclarator here.
|
|
27
|
-
.field("head", [def("VariableDeclarator")])
|
|
28
|
-
.field("body", def("Statement"));
|
|
29
|
-
def("LetExpression")
|
|
30
|
-
.bases("Expression")
|
|
31
|
-
.build("head", "body")
|
|
32
|
-
// TODO Deviating from the spec by reusing VariableDeclarator here.
|
|
33
|
-
.field("head", [def("VariableDeclarator")])
|
|
34
|
-
.field("body", def("Expression"));
|
|
35
|
-
def("GraphExpression")
|
|
36
|
-
.bases("Expression")
|
|
37
|
-
.build("index", "expression")
|
|
38
|
-
.field("index", geq(0))
|
|
39
|
-
.field("expression", def("Literal"));
|
|
40
|
-
def("GraphIndexExpression")
|
|
41
|
-
.bases("Expression")
|
|
42
|
-
.build("index")
|
|
43
|
-
.field("index", geq(0));
|
|
44
|
-
}
|
|
45
|
-
exports.default = default_1;
|
|
46
|
-
module.exports = exports["default"];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Fork } from "../types";
|
|
2
|
-
import { Field, Type } from "./types";
|
|
3
|
-
export interface TSTypeAnnotatorConfig {
|
|
4
|
-
getReferenceToKind(typeName: string): any;
|
|
5
|
-
}
|
|
6
|
-
export default function typeAnnotationsPlugin(fork: Fork): {
|
|
7
|
-
createTSTypeAnnotator: (config: TSTypeAnnotatorConfig) => {
|
|
8
|
-
getTSTypeAnnotation: (type: Type<any>) => any;
|
|
9
|
-
getTSPropertySignature: (field: Field<any>) => any;
|
|
10
|
-
};
|
|
11
|
-
};
|
package/lib/type-annotations.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var types_1 = __importDefault(require("./types"));
|
|
7
|
-
var utils_1 = require("./utils");
|
|
8
|
-
var Op = Object.prototype;
|
|
9
|
-
var hasOwn = Op.hasOwnProperty;
|
|
10
|
-
function typeAnnotationsPlugin(fork) {
|
|
11
|
-
var _a = fork.use(types_1.default), builders = _a.builders, namedTypes = _a.namedTypes;
|
|
12
|
-
function createTSTypeAnnotator(config) {
|
|
13
|
-
function getTSTypeAnnotation(type) {
|
|
14
|
-
switch (type.kind) {
|
|
15
|
-
case "ArrayType": {
|
|
16
|
-
var elemTypeAnnotation = getTSTypeAnnotation(type.elemType);
|
|
17
|
-
// TODO Improve this test.
|
|
18
|
-
if (namedTypes.TSUnionType.check(elemTypeAnnotation)) {
|
|
19
|
-
elemTypeAnnotation = builders.tsParenthesizedType(elemTypeAnnotation);
|
|
20
|
-
}
|
|
21
|
-
return builders.tsArrayType(elemTypeAnnotation);
|
|
22
|
-
}
|
|
23
|
-
case "IdentityType": {
|
|
24
|
-
if (type.value === null) {
|
|
25
|
-
return builders.tsNullKeyword();
|
|
26
|
-
}
|
|
27
|
-
switch (typeof type.value) {
|
|
28
|
-
case "undefined":
|
|
29
|
-
return builders.tsUndefinedKeyword();
|
|
30
|
-
case "string":
|
|
31
|
-
return builders.tsLiteralType(builders.stringLiteral(type.value));
|
|
32
|
-
case "boolean":
|
|
33
|
-
return builders.tsLiteralType(builders.booleanLiteral(type.value));
|
|
34
|
-
case "number":
|
|
35
|
-
return builders.tsNumberKeyword();
|
|
36
|
-
case "object":
|
|
37
|
-
return builders.tsObjectKeyword();
|
|
38
|
-
case "function":
|
|
39
|
-
return builders.tsFunctionType();
|
|
40
|
-
case "symbol":
|
|
41
|
-
return builders.tsSymbolKeyword();
|
|
42
|
-
default:
|
|
43
|
-
return builders.tsAnyKeyword();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
case "ObjectType": {
|
|
47
|
-
return builders.tsTypeLiteral.from({
|
|
48
|
-
members: type.fields.map(function (field) { return getTSPropertySignature(field); }),
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
case "OrType": {
|
|
52
|
-
return builders.tsUnionType(type.types.map(function (type) { return getTSTypeAnnotation(type); }));
|
|
53
|
-
}
|
|
54
|
-
case "PredicateType": {
|
|
55
|
-
if (typeof type.name !== "string") {
|
|
56
|
-
return builders.tsAnyKeyword();
|
|
57
|
-
}
|
|
58
|
-
if (hasOwn.call(namedTypes, type.name)) {
|
|
59
|
-
return config.getReferenceToKind(type.name);
|
|
60
|
-
}
|
|
61
|
-
if (/^[$A-Z_][a-z0-9_$]*$/i.test(type.name)) {
|
|
62
|
-
return builders.tsTypeReference(builders.identifier(type.name));
|
|
63
|
-
}
|
|
64
|
-
if (/^number [<>=]+ \d+$/.test(type.name)) {
|
|
65
|
-
return builders.tsNumberKeyword();
|
|
66
|
-
}
|
|
67
|
-
// Not much else to do...
|
|
68
|
-
return builders.tsAnyKeyword();
|
|
69
|
-
}
|
|
70
|
-
default:
|
|
71
|
-
return utils_1.assertNever(type);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function getTSPropertySignature(field) {
|
|
75
|
-
return builders.tsPropertySignature.from({
|
|
76
|
-
key: builders.identifier(field.name),
|
|
77
|
-
typeAnnotation: builders.tsTypeAnnotation(getTSTypeAnnotation(field.type)),
|
|
78
|
-
optional: field.defaultFn != null || field.hidden,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
getTSTypeAnnotation: getTSTypeAnnotation,
|
|
83
|
-
getTSPropertySignature: getTSPropertySignature,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
createTSTypeAnnotator: createTSTypeAnnotator,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
exports.default = typeAnnotationsPlugin;
|
package/lib/utils.d.ts
DELETED
package/lib/utils.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function assertNever(x) {
|
|
4
|
-
throw new Error("Unexpected: " + x);
|
|
5
|
-
}
|
|
6
|
-
exports.assertNever = assertNever;
|
|
7
|
-
function shallowStringify(value) {
|
|
8
|
-
if (Array.isArray(value)) {
|
|
9
|
-
return "[" + value.map(shallowStringify).join(", ") + "]";
|
|
10
|
-
}
|
|
11
|
-
if (value && typeof value === "object") {
|
|
12
|
-
return "{ " + Object.keys(value).map(function (key) {
|
|
13
|
-
return key + ": " + value[key];
|
|
14
|
-
}).join(", ") + " }";
|
|
15
|
-
}
|
|
16
|
-
return JSON.stringify(value);
|
|
17
|
-
}
|
|
18
|
-
exports.shallowStringify = shallowStringify;
|