ast-types 0.12.2 → 0.13.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/gen/namedTypes.js CHANGED
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ var namedTypes;
4
+ (function (namedTypes) {
5
+ })(namedTypes = exports.namedTypes || (exports.namedTypes = {}));
package/gen/nodes.d.ts CHANGED
@@ -46,11 +46,11 @@ export interface Function extends Node {
46
46
  returnType: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
47
47
  typeParameters: K.TypeParameterDeclarationKind | K.TSTypeParameterDeclarationKind | null;
48
48
  }
49
- export interface Pattern extends Node {
49
+ export interface Expression extends Node {
50
50
  }
51
- export interface Expression extends Node, Pattern {
51
+ export interface Pattern extends Node {
52
52
  }
53
- export interface Identifier extends Omit<Node, "type">, Omit<Expression, "type">, Omit<Pattern, "type"> {
53
+ export interface Identifier extends Omit<Expression, "type">, Omit<Pattern, "type"> {
54
54
  type: "Identifier";
55
55
  name: string;
56
56
  optional: boolean;
@@ -191,7 +191,7 @@ export interface Property extends Omit<Node, "type"> {
191
191
  computed: boolean;
192
192
  decorators: K.DecoratorKind[] | null;
193
193
  }
194
- export interface Literal extends Omit<Node, "type">, Omit<Expression, "type"> {
194
+ export interface Literal extends Omit<Expression, "type"> {
195
195
  type: "Literal";
196
196
  value: string | boolean | null | number | RegExp;
197
197
  regex: {
@@ -218,9 +218,15 @@ export interface BinaryExpression extends Omit<Expression, "type"> {
218
218
  export interface AssignmentExpression extends Omit<Expression, "type"> {
219
219
  type: "AssignmentExpression";
220
220
  operator: "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=";
221
- left: K.PatternKind;
221
+ left: K.PatternKind | K.MemberExpressionKind;
222
222
  right: K.ExpressionKind;
223
223
  }
224
+ export interface MemberExpression extends Omit<Expression, "type"> {
225
+ type: "MemberExpression";
226
+ object: K.ExpressionKind;
227
+ property: K.IdentifierKind | K.ExpressionKind;
228
+ computed: boolean;
229
+ }
224
230
  export interface UpdateExpression extends Omit<Expression, "type"> {
225
231
  type: "UpdateExpression";
226
232
  operator: "++" | "--";
@@ -249,12 +255,6 @@ export interface CallExpression extends Omit<Expression, "type"> {
249
255
  callee: K.ExpressionKind;
250
256
  arguments: (K.ExpressionKind | K.SpreadElementKind)[];
251
257
  }
252
- export interface MemberExpression extends Omit<Expression, "type"> {
253
- type: "MemberExpression";
254
- object: K.ExpressionKind;
255
- property: K.IdentifierKind | K.ExpressionKind;
256
- computed: boolean;
257
- }
258
258
  export interface RestElement extends Omit<Pattern, "type"> {
259
259
  type: "RestElement";
260
260
  argument: K.PatternKind;
@@ -361,6 +361,7 @@ export interface ClassProperty extends Omit<Declaration, "type"> {
361
361
  static: boolean;
362
362
  typeAnnotation: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
363
363
  variance: K.VarianceKind | "plus" | "minus" | null;
364
+ access: "public" | "private" | "protected" | undefined;
364
365
  }
365
366
  export interface ClassBody extends Omit<Declaration, "type"> {
366
367
  type: "ClassBody";
@@ -984,7 +985,7 @@ export interface TSHasOptionalTypeParameters {
984
985
  export interface TSHasOptionalTypeAnnotation {
985
986
  typeAnnotation: K.TSTypeAnnotationKind | null;
986
987
  }
987
- export interface TSAsExpression extends Omit<Expression, "type"> {
988
+ export interface TSAsExpression extends Omit<Expression, "type">, Omit<Pattern, "type"> {
988
989
  type: "TSAsExpression";
989
990
  expression: K.ExpressionKind;
990
991
  typeAnnotation: K.TSTypeKind;
@@ -992,7 +993,7 @@ export interface TSAsExpression extends Omit<Expression, "type"> {
992
993
  parenthesized: boolean;
993
994
  } | null;
994
995
  }
995
- export interface TSNonNullExpression extends Omit<Expression, "type"> {
996
+ export interface TSNonNullExpression extends Omit<Expression, "type">, Omit<Pattern, "type"> {
996
997
  type: "TSNonNullExpression";
997
998
  expression: K.ExpressionKind;
998
999
  }
@@ -1041,7 +1042,7 @@ export interface TSArrayType extends Omit<TSType, "type"> {
1041
1042
  }
1042
1043
  export interface TSLiteralType extends Omit<TSType, "type"> {
1043
1044
  type: "TSLiteralType";
1044
- literal: K.NumericLiteralKind | K.StringLiteralKind | K.BooleanLiteralKind;
1045
+ literal: K.NumericLiteralKind | K.StringLiteralKind | K.BooleanLiteralKind | K.TemplateLiteralKind | K.UnaryExpressionKind;
1045
1046
  }
1046
1047
  export interface TSUnionType extends Omit<TSType, "type"> {
1047
1048
  type: "TSUnionType";
@@ -1074,11 +1075,11 @@ export interface TSParenthesizedType extends Omit<TSType, "type"> {
1074
1075
  }
1075
1076
  export interface TSFunctionType extends Omit<TSType, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1076
1077
  type: "TSFunctionType";
1077
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1078
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1078
1079
  }
1079
1080
  export interface TSConstructorType extends Omit<TSType, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1080
1081
  type: "TSConstructorType";
1081
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1082
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1082
1083
  }
1083
1084
  export interface TSDeclareFunction extends Omit<Declaration, "type">, TSHasOptionalTypeParameters {
1084
1085
  type: "TSDeclareFunction";
@@ -1152,7 +1153,7 @@ export interface TSMethodSignature extends Omit<Declaration, "type">, TSHasOptio
1152
1153
  key: K.ExpressionKind;
1153
1154
  computed: boolean;
1154
1155
  optional: boolean;
1155
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1156
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1156
1157
  }
1157
1158
  export interface TSTypePredicate extends Omit<TSTypeAnnotation, "type" | "typeAnnotation"> {
1158
1159
  type: "TSTypePredicate";
@@ -1161,11 +1162,11 @@ export interface TSTypePredicate extends Omit<TSTypeAnnotation, "type" | "typeAn
1161
1162
  }
1162
1163
  export interface TSCallSignatureDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1163
1164
  type: "TSCallSignatureDeclaration";
1164
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1165
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1165
1166
  }
1166
1167
  export interface TSConstructSignatureDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1167
1168
  type: "TSConstructSignatureDeclaration";
1168
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1169
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1169
1170
  }
1170
1171
  export interface TSEnumMember extends Omit<Node, "type"> {
1171
1172
  type: "TSEnumMember";
@@ -1185,7 +1186,7 @@ export interface TSTypeLiteral extends Omit<TSType, "type"> {
1185
1186
  type: "TSTypeLiteral";
1186
1187
  members: (K.TSCallSignatureDeclarationKind | K.TSConstructSignatureDeclarationKind | K.TSIndexSignatureKind | K.TSMethodSignatureKind | K.TSPropertySignatureKind)[];
1187
1188
  }
1188
- export interface TSTypeAssertion extends Omit<Expression, "type"> {
1189
+ export interface TSTypeAssertion extends Omit<Expression, "type">, Omit<Pattern, "type"> {
1189
1190
  type: "TSTypeAssertion";
1190
1191
  typeAnnotation: K.TSTypeKind;
1191
1192
  expression: K.ExpressionKind;
@@ -1261,4 +1262,4 @@ export interface OptionalCallExpression extends Omit<CallExpression, "type"> {
1261
1262
  type: "OptionalCallExpression";
1262
1263
  optional: boolean;
1263
1264
  }
1264
- 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 | TSBigIntKeyword | 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 | TSImportType | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;
1265
+ 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 | MemberExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | 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 | TSBigIntKeyword | 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 | TSImportType | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;