UNPKG

@babel/types

Version:

Babel Types is a Lodash-esque utility library for AST nodes

1,434 lines 607 kB
interface BaseComment { value: string; start?: number; end?: number; loc?: SourceLocation; ignore?: boolean; type: "CommentBlock" | "CommentLine"; } interface CommentBlock extends BaseComment { type: "CommentBlock"; } interface CommentLine extends BaseComment { type: "CommentLine"; } type Comment = CommentBlock | CommentLine; interface SourceLocation { start: { line: number; column: number; }; end: { line: number; column: number; }; } interface BaseNode { type: Node["type"]; leadingComments?: Comment[] | null; innerComments?: Comment[] | null; trailingComments?: Comment[] | null; start?: number | null; end?: number | null; loc?: SourceLocation | null; range?: [number, number]; extra?: Record<string, unknown>; } type CommentTypeShorthand = "leading" | "inner" | "trailing"; type Node = AnyTypeAnnotation | ArgumentPlaceholder | ArrayExpression | ArrayPattern | ArrayTypeAnnotation | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | BinaryExpression | BindExpression | BlockStatement | BooleanLiteral | BooleanLiteralTypeAnnotation | BooleanTypeAnnotation | BreakStatement | CallExpression | CatchClause | ClassAccessorProperty | ClassBody | ClassDeclaration | ClassExpression | ClassImplements | ClassMethod | ClassPrivateMethod | ClassPrivateProperty | ClassProperty | ConditionalExpression | ContinueStatement | DebuggerStatement | DecimalLiteral | DeclareClass | DeclareExportAllDeclaration | DeclareExportDeclaration | DeclareFunction | DeclareInterface | DeclareModule | DeclareModuleExports | DeclareOpaqueType | DeclareTypeAlias | DeclareVariable | DeclaredPredicate | Decorator | Directive | DirectiveLiteral | DoExpression | DoWhileStatement | EmptyStatement | EmptyTypeAnnotation | EnumBooleanBody | EnumBooleanMember | EnumDeclaration | EnumDefaultedMember | EnumNumberBody | EnumNumberMember | EnumStringBody | EnumStringMember | EnumSymbolBody | ExistsTypeAnnotation | ExportAllDeclaration | ExportDefaultDeclaration | ExportDefaultSpecifier | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportSpecifier | ExpressionStatement | File | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | FunctionTypeAnnotation | FunctionTypeParam | GenericTypeAnnotation | Identifier | IfStatement | Import | ImportAttribute | ImportDeclaration | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier | IndexedAccessType | InferredPredicate | InterfaceDeclaration | InterfaceExtends | InterfaceTypeAnnotation | InterpreterDirective | IntersectionTypeAnnotation | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXMemberExpression | JSXNamespacedName | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXText | LabeledStatement | LogicalExpression | MemberExpression | MetaProperty | MixedTypeAnnotation | ModuleExpression | NewExpression | Noop | NullLiteral | NullLiteralTypeAnnotation | NullableTypeAnnotation | NumberLiteral$1 | NumberLiteralTypeAnnotation | NumberTypeAnnotation | NumericLiteral | ObjectExpression | ObjectMethod | ObjectPattern | ObjectProperty | ObjectTypeAnnotation | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeInternalSlot | ObjectTypeProperty | ObjectTypeSpreadProperty | OpaqueType | OptionalCallExpression | OptionalIndexedAccessType | OptionalMemberExpression | ParenthesizedExpression | PipelineBareFunction | PipelinePrimaryTopicReference | PipelineTopicExpression | Placeholder | PrivateName | Program | QualifiedTypeIdentifier | RecordExpression | RegExpLiteral | RegexLiteral$1 | RestElement | RestProperty$1 | ReturnStatement | SequenceExpression | SpreadElement | SpreadProperty$1 | StaticBlock | StringLiteral | StringLiteralTypeAnnotation | StringTypeAnnotation | Super | SwitchCase | SwitchStatement | SymbolTypeAnnotation | TSAnyKeyword | TSArrayType | TSAsExpression | TSBigIntKeyword | TSBooleanKeyword | TSCallSignatureDeclaration | TSConditionalType | TSConstructSignatureDeclaration | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSEnumDeclaration | TSEnumMember | TSExportAssignment | TSExpressionWithTypeArguments | TSExternalModuleReference | TSFunctionType | TSImportEqualsDeclaration | TSImportType | TSIndexSignature | TSIndexedAccessType | TSInferType | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSIntersectionType | TSIntrinsicKeyword | TSLiteralType | TSMappedType | TSMethodSignature | TSModuleBlock | TSModuleDeclaration | TSNamedTupleMember | TSNamespaceExportDeclaration | TSNeverKeyword | TSNonNullExpression | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSOptionalType | TSParameterProperty | TSParenthesizedType | TSPropertySignature | TSQualifiedName | TSRestType | TSSatisfiesExpression | TSStringKeyword | TSSymbolKeyword | TSThisType | TSTupleType | TSTypeAliasDeclaration | TSTypeAnnotation | TSTypeAssertion | TSTypeLiteral | TSTypeOperator | TSTypeParameter | TSTypeParameterDeclaration | TSTypeParameterInstantiation | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUndefinedKeyword | TSUnionType | TSUnknownKeyword | TSVoidKeyword | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThisTypeAnnotation | ThrowStatement | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation | TypeAlias | TypeAnnotation | TypeCastExpression | TypeParameter | TypeParameterDeclaration | TypeParameterInstantiation | TypeofTypeAnnotation | UnaryExpression | UnionTypeAnnotation | UpdateExpression | V8IntrinsicIdentifier | VariableDeclaration | VariableDeclarator | Variance | VoidTypeAnnotation | WhileStatement | WithStatement | YieldExpression; interface ArrayExpression extends BaseNode { type: "ArrayExpression"; elements: Array<null | Expression | SpreadElement>; } interface AssignmentExpression extends BaseNode { type: "AssignmentExpression"; operator: string; left: LVal; right: Expression; } interface BinaryExpression extends BaseNode { type: "BinaryExpression"; operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>"; left: Expression | PrivateName; right: Expression; } interface InterpreterDirective extends BaseNode { type: "InterpreterDirective"; value: string; } interface Directive extends BaseNode { type: "Directive"; value: DirectiveLiteral; } interface DirectiveLiteral extends BaseNode { type: "DirectiveLiteral"; value: string; } interface BlockStatement extends BaseNode { type: "BlockStatement"; body: Array<Statement>; directives: Array<Directive>; } interface BreakStatement extends BaseNode { type: "BreakStatement"; label?: Identifier | null; } interface CallExpression extends BaseNode { type: "CallExpression"; callee: Expression | Super | V8IntrinsicIdentifier; arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>; optional?: true | false | null; typeArguments?: TypeParameterInstantiation | null; typeParameters?: TSTypeParameterInstantiation | null; } interface CatchClause extends BaseNode { type: "CatchClause"; param?: Identifier | ArrayPattern | ObjectPattern | null; body: BlockStatement; } interface ConditionalExpression extends BaseNode { type: "ConditionalExpression"; test: Expression; consequent: Expression; alternate: Expression; } interface ContinueStatement extends BaseNode { type: "ContinueStatement"; label?: Identifier | null; } interface DebuggerStatement extends BaseNode { type: "DebuggerStatement"; } interface DoWhileStatement extends BaseNode { type: "DoWhileStatement"; test: Expression; body: Statement; } interface EmptyStatement extends BaseNode { type: "EmptyStatement"; } interface ExpressionStatement extends BaseNode { type: "ExpressionStatement"; expression: Expression; } interface File extends BaseNode { type: "File"; program: Program; comments?: Array<CommentBlock | CommentLine> | null; tokens?: Array<any> | null; } interface ForInStatement extends BaseNode { type: "ForInStatement"; left: VariableDeclaration | LVal; right: Expression; body: Statement; } interface ForStatement extends BaseNode { type: "ForStatement"; init?: VariableDeclaration | Expression | null; test?: Expression | null; update?: Expression | null; body: Statement; } interface FunctionDeclaration extends BaseNode { type: "FunctionDeclaration"; id?: Identifier | null; params: Array<Identifier | Pattern | RestElement>; body: BlockStatement; generator: boolean; async: boolean; declare?: boolean | null; predicate?: DeclaredPredicate | InferredPredicate | null; returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface FunctionExpression extends BaseNode { type: "FunctionExpression"; id?: Identifier | null; params: Array<Identifier | Pattern | RestElement>; body: BlockStatement; generator: boolean; async: boolean; predicate?: DeclaredPredicate | InferredPredicate | null; returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface Identifier extends BaseNode { type: "Identifier"; name: string; decorators?: Array<Decorator> | null; optional?: boolean | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; } interface IfStatement extends BaseNode { type: "IfStatement"; test: Expression; consequent: Statement; alternate?: Statement | null; } interface LabeledStatement extends BaseNode { type: "LabeledStatement"; label: Identifier; body: Statement; } interface StringLiteral extends BaseNode { type: "StringLiteral"; value: string; } interface NumericLiteral extends BaseNode { type: "NumericLiteral"; value: number; } /** * @deprecated Use `NumericLiteral` */ interface NumberLiteral$1 extends BaseNode { type: "NumberLiteral"; value: number; } interface NullLiteral extends BaseNode { type: "NullLiteral"; } interface BooleanLiteral extends BaseNode { type: "BooleanLiteral"; value: boolean; } interface RegExpLiteral extends BaseNode { type: "RegExpLiteral"; pattern: string; flags: string; } /** * @deprecated Use `RegExpLiteral` */ interface RegexLiteral$1 extends BaseNode { type: "RegexLiteral"; pattern: string; flags: string; } interface LogicalExpression extends BaseNode { type: "LogicalExpression"; operator: "||" | "&&" | "??"; left: Expression; right: Expression; } interface MemberExpression extends BaseNode { type: "MemberExpression"; object: Expression | Super; property: Expression | Identifier | PrivateName; computed: boolean; optional?: true | false | null; } interface NewExpression extends BaseNode { type: "NewExpression"; callee: Expression | Super | V8IntrinsicIdentifier; arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>; optional?: true | false | null; typeArguments?: TypeParameterInstantiation | null; typeParameters?: TSTypeParameterInstantiation | null; } interface Program extends BaseNode { type: "Program"; body: Array<Statement>; directives: Array<Directive>; sourceType: "script" | "module"; interpreter?: InterpreterDirective | null; sourceFile: string; } interface ObjectExpression extends BaseNode { type: "ObjectExpression"; properties: Array<ObjectMethod | ObjectProperty | SpreadElement>; } interface ObjectMethod extends BaseNode { type: "ObjectMethod"; kind: "method" | "get" | "set"; key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral; params: Array<Identifier | Pattern | RestElement>; body: BlockStatement; computed: boolean; generator: boolean; async: boolean; decorators?: Array<Decorator> | null; returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface ObjectProperty extends BaseNode { type: "ObjectProperty"; key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral | DecimalLiteral | PrivateName; value: Expression | PatternLike; computed: boolean; shorthand: boolean; decorators?: Array<Decorator> | null; } interface RestElement extends BaseNode { type: "RestElement"; argument: LVal; decorators?: Array<Decorator> | null; optional?: boolean | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; } /** * @deprecated Use `RestElement` */ interface RestProperty$1 extends BaseNode { type: "RestProperty"; argument: LVal; decorators?: Array<Decorator> | null; optional?: boolean | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; } interface ReturnStatement extends BaseNode { type: "ReturnStatement"; argument?: Expression | null; } interface SequenceExpression extends BaseNode { type: "SequenceExpression"; expressions: Array<Expression>; } interface ParenthesizedExpression extends BaseNode { type: "ParenthesizedExpression"; expression: Expression; } interface SwitchCase extends BaseNode { type: "SwitchCase"; test?: Expression | null; consequent: Array<Statement>; } interface SwitchStatement extends BaseNode { type: "SwitchStatement"; discriminant: Expression; cases: Array<SwitchCase>; } interface ThisExpression extends BaseNode { type: "ThisExpression"; } interface ThrowStatement extends BaseNode { type: "ThrowStatement"; argument: Expression; } interface TryStatement extends BaseNode { type: "TryStatement"; block: BlockStatement; handler?: CatchClause | null; finalizer?: BlockStatement | null; } interface UnaryExpression extends BaseNode { type: "UnaryExpression"; operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof"; argument: Expression; prefix: boolean; } interface UpdateExpression extends BaseNode { type: "UpdateExpression"; operator: "++" | "--"; argument: Expression; prefix: boolean; } interface VariableDeclaration extends BaseNode { type: "VariableDeclaration"; kind: "var" | "let" | "const" | "using"; declarations: Array<VariableDeclarator>; declare?: boolean | null; } interface VariableDeclarator extends BaseNode { type: "VariableDeclarator"; id: LVal; init?: Expression | null; definite?: boolean | null; } interface WhileStatement extends BaseNode { type: "WhileStatement"; test: Expression; body: Statement; } interface WithStatement extends BaseNode { type: "WithStatement"; object: Expression; body: Statement; } interface AssignmentPattern extends BaseNode { type: "AssignmentPattern"; left: Identifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression; right: Expression; decorators?: Array<Decorator> | null; optional?: boolean | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; } interface ArrayPattern extends BaseNode { type: "ArrayPattern"; elements: Array<null | PatternLike | LVal>; decorators?: Array<Decorator> | null; optional?: boolean | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; } interface ArrowFunctionExpression extends BaseNode { type: "ArrowFunctionExpression"; params: Array<Identifier | Pattern | RestElement>; body: BlockStatement | Expression; async: boolean; expression: boolean; generator?: boolean; predicate?: DeclaredPredicate | InferredPredicate | null; returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface ClassBody extends BaseNode { type: "ClassBody"; body: Array<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock>; } interface ClassExpression extends BaseNode { type: "ClassExpression"; id?: Identifier | null; superClass?: Expression | null; body: ClassBody; decorators?: Array<Decorator> | null; implements?: Array<TSExpressionWithTypeArguments | ClassImplements> | null; mixins?: InterfaceExtends | null; superTypeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface ClassDeclaration extends BaseNode { type: "ClassDeclaration"; id: Identifier; superClass?: Expression | null; body: ClassBody; decorators?: Array<Decorator> | null; abstract?: boolean | null; declare?: boolean | null; implements?: Array<TSExpressionWithTypeArguments | ClassImplements> | null; mixins?: InterfaceExtends | null; superTypeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface ExportAllDeclaration extends BaseNode { type: "ExportAllDeclaration"; source: StringLiteral; assertions?: Array<ImportAttribute> | null; exportKind?: "type" | "value" | null; } interface ExportDefaultDeclaration extends BaseNode { type: "ExportDefaultDeclaration"; declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression; exportKind?: "value" | null; } interface ExportNamedDeclaration extends BaseNode { type: "ExportNamedDeclaration"; declaration?: Declaration | null; specifiers: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier>; source?: StringLiteral | null; assertions?: Array<ImportAttribute> | null; exportKind?: "type" | "value" | null; } interface ExportSpecifier extends BaseNode { type: "ExportSpecifier"; local: Identifier; exported: Identifier | StringLiteral; exportKind?: "type" | "value" | null; } interface ForOfStatement extends BaseNode { type: "ForOfStatement"; left: VariableDeclaration | LVal; right: Expression; body: Statement; await: boolean; } interface ImportDeclaration extends BaseNode { type: "ImportDeclaration"; specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>; source: StringLiteral; assertions?: Array<ImportAttribute> | null; importKind?: "type" | "typeof" | "value" | null; module?: boolean | null; } interface ImportDefaultSpecifier extends BaseNode { type: "ImportDefaultSpecifier"; local: Identifier; } interface ImportNamespaceSpecifier extends BaseNode { type: "ImportNamespaceSpecifier"; local: Identifier; } interface ImportSpecifier extends BaseNode { type: "ImportSpecifier"; local: Identifier; imported: Identifier | StringLiteral; importKind?: "type" | "typeof" | "value" | null; } interface MetaProperty extends BaseNode { type: "MetaProperty"; meta: Identifier; property: Identifier; } interface ClassMethod extends BaseNode { type: "ClassMethod"; kind: "get" | "set" | "method" | "constructor"; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression; params: Array<Identifier | Pattern | RestElement | TSParameterProperty>; body: BlockStatement; computed: boolean; static: boolean; generator: boolean; async: boolean; abstract?: boolean | null; access?: "public" | "private" | "protected" | null; accessibility?: "public" | "private" | "protected" | null; decorators?: Array<Decorator> | null; optional?: boolean | null; override?: boolean; returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface ObjectPattern extends BaseNode { type: "ObjectPattern"; properties: Array<RestElement | ObjectProperty>; decorators?: Array<Decorator> | null; optional?: boolean | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; } interface SpreadElement extends BaseNode { type: "SpreadElement"; argument: Expression; } /** * @deprecated Use `SpreadElement` */ interface SpreadProperty$1 extends BaseNode { type: "SpreadProperty"; argument: Expression; } interface Super extends BaseNode { type: "Super"; } interface TaggedTemplateExpression extends BaseNode { type: "TaggedTemplateExpression"; tag: Expression; quasi: TemplateLiteral; typeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null; } interface TemplateElement extends BaseNode { type: "TemplateElement"; value: { raw: string; cooked?: string; }; tail: boolean; } interface TemplateLiteral extends BaseNode { type: "TemplateLiteral"; quasis: Array<TemplateElement>; expressions: Array<Expression | TSType>; } interface YieldExpression extends BaseNode { type: "YieldExpression"; argument?: Expression | null; delegate: boolean; } interface AwaitExpression extends BaseNode { type: "AwaitExpression"; argument: Expression; } interface Import extends BaseNode { type: "Import"; } interface BigIntLiteral extends BaseNode { type: "BigIntLiteral"; value: string; } interface ExportNamespaceSpecifier extends BaseNode { type: "ExportNamespaceSpecifier"; exported: Identifier; } interface OptionalMemberExpression extends BaseNode { type: "OptionalMemberExpression"; object: Expression; property: Expression | Identifier; computed: boolean; optional: boolean; } interface OptionalCallExpression extends BaseNode { type: "OptionalCallExpression"; callee: Expression; arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>; optional: boolean; typeArguments?: TypeParameterInstantiation | null; typeParameters?: TSTypeParameterInstantiation | null; } interface ClassProperty extends BaseNode { type: "ClassProperty"; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression; value?: Expression | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; decorators?: Array<Decorator> | null; computed: boolean; static: boolean; abstract?: boolean | null; accessibility?: "public" | "private" | "protected" | null; declare?: boolean | null; definite?: boolean | null; optional?: boolean | null; override?: boolean; readonly?: boolean | null; variance?: Variance | null; } interface ClassAccessorProperty extends BaseNode { type: "ClassAccessorProperty"; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName; value?: Expression | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; decorators?: Array<Decorator> | null; computed: boolean; static: boolean; abstract?: boolean | null; accessibility?: "public" | "private" | "protected" | null; declare?: boolean | null; definite?: boolean | null; optional?: boolean | null; override?: boolean; readonly?: boolean | null; variance?: Variance | null; } interface ClassPrivateProperty extends BaseNode { type: "ClassPrivateProperty"; key: PrivateName; value?: Expression | null; decorators?: Array<Decorator> | null; static: boolean; definite?: boolean | null; readonly?: boolean | null; typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null; variance?: Variance | null; } interface ClassPrivateMethod extends BaseNode { type: "ClassPrivateMethod"; kind: "get" | "set" | "method"; key: PrivateName; params: Array<Identifier | Pattern | RestElement | TSParameterProperty>; body: BlockStatement; static: boolean; abstract?: boolean | null; access?: "public" | "private" | "protected" | null; accessibility?: "public" | "private" | "protected" | null; async?: boolean; computed?: boolean; decorators?: Array<Decorator> | null; generator?: boolean; optional?: boolean | null; override?: boolean; returnType?: TypeAnnotation | TSTypeAnnotation | Noop | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop | null; } interface PrivateName extends BaseNode { type: "PrivateName"; id: Identifier; } interface StaticBlock extends BaseNode { type: "StaticBlock"; body: Array<Statement>; } interface AnyTypeAnnotation extends BaseNode { type: "AnyTypeAnnotation"; } interface ArrayTypeAnnotation extends BaseNode { type: "ArrayTypeAnnotation"; elementType: FlowType; } interface BooleanTypeAnnotation extends BaseNode { type: "BooleanTypeAnnotation"; } interface BooleanLiteralTypeAnnotation extends BaseNode { type: "BooleanLiteralTypeAnnotation"; value: boolean; } interface NullLiteralTypeAnnotation extends BaseNode { type: "NullLiteralTypeAnnotation"; } interface ClassImplements extends BaseNode { type: "ClassImplements"; id: Identifier; typeParameters?: TypeParameterInstantiation | null; } interface DeclareClass extends BaseNode { type: "DeclareClass"; id: Identifier; typeParameters?: TypeParameterDeclaration | null; extends?: Array<InterfaceExtends> | null; body: ObjectTypeAnnotation; implements?: Array<ClassImplements> | null; mixins?: Array<InterfaceExtends> | null; } interface DeclareFunction extends BaseNode { type: "DeclareFunction"; id: Identifier; predicate?: DeclaredPredicate | null; } interface DeclareInterface extends BaseNode { type: "DeclareInterface"; id: Identifier; typeParameters?: TypeParameterDeclaration | null; extends?: Array<InterfaceExtends> | null; body: ObjectTypeAnnotation; implements?: Array<ClassImplements> | null; mixins?: Array<InterfaceExtends> | null; } interface DeclareModule extends BaseNode { type: "DeclareModule"; id: Identifier | StringLiteral; body: BlockStatement; kind?: "CommonJS" | "ES" | null; } interface DeclareModuleExports extends BaseNode { type: "DeclareModuleExports"; typeAnnotation: TypeAnnotation; } interface DeclareTypeAlias extends BaseNode { type: "DeclareTypeAlias"; id: Identifier; typeParameters?: TypeParameterDeclaration | null; right: FlowType; } interface DeclareOpaqueType extends BaseNode { type: "DeclareOpaqueType"; id: Identifier; typeParameters?: TypeParameterDeclaration | null; supertype?: FlowType | null; impltype?: FlowType | null; } interface DeclareVariable extends BaseNode { type: "DeclareVariable"; id: Identifier; } interface DeclareExportDeclaration extends BaseNode { type: "DeclareExportDeclaration"; declaration?: Flow | null; specifiers?: Array<ExportSpecifier | ExportNamespaceSpecifier> | null; source?: StringLiteral | null; default?: boolean | null; } interface DeclareExportAllDeclaration extends BaseNode { type: "DeclareExportAllDeclaration"; source: StringLiteral; exportKind?: "type" | "value" | null; } interface DeclaredPredicate extends BaseNode { type: "DeclaredPredicate"; value: Flow; } interface ExistsTypeAnnotation extends BaseNode { type: "ExistsTypeAnnotation"; } interface FunctionTypeAnnotation extends BaseNode { type: "FunctionTypeAnnotation"; typeParameters?: TypeParameterDeclaration | null; params: Array<FunctionTypeParam>; rest?: FunctionTypeParam | null; returnType: FlowType; this?: FunctionTypeParam | null; } interface FunctionTypeParam extends BaseNode { type: "FunctionTypeParam"; name?: Identifier | null; typeAnnotation: FlowType; optional?: boolean | null; } interface GenericTypeAnnotation extends BaseNode { type: "GenericTypeAnnotation"; id: Identifier | QualifiedTypeIdentifier; typeParameters?: TypeParameterInstantiation | null; } interface InferredPredicate extends BaseNode { type: "InferredPredicate"; } interface InterfaceExtends extends BaseNode { type: "InterfaceExtends"; id: Identifier | QualifiedTypeIdentifier; typeParameters?: TypeParameterInstantiation | null; } interface InterfaceDeclaration extends BaseNode { type: "InterfaceDeclaration"; id: Identifier; typeParameters?: TypeParameterDeclaration | null; extends?: Array<InterfaceExtends> | null; body: ObjectTypeAnnotation; implements?: Array<ClassImplements> | null; mixins?: Array<InterfaceExtends> | null; } interface InterfaceTypeAnnotation extends BaseNode { type: "InterfaceTypeAnnotation"; extends?: Array<InterfaceExtends> | null; body: ObjectTypeAnnotation; } interface IntersectionTypeAnnotation extends BaseNode { type: "IntersectionTypeAnnotation"; types: Array<FlowType>; } interface MixedTypeAnnotation extends BaseNode { type: "MixedTypeAnnotation"; } interface EmptyTypeAnnotation extends BaseNode { type: "EmptyTypeAnnotation"; } interface NullableTypeAnnotation extends BaseNode { type: "NullableTypeAnnotation"; typeAnnotation: FlowType; } interface NumberLiteralTypeAnnotation extends BaseNode { type: "NumberLiteralTypeAnnotation"; value: number; } interface NumberTypeAnnotation extends BaseNode { type: "NumberTypeAnnotation"; } interface ObjectTypeAnnotation extends BaseNode { type: "ObjectTypeAnnotation"; properties: Array<ObjectTypeProperty | ObjectTypeSpreadProperty>; indexers?: Array<ObjectTypeIndexer>; callProperties?: Array<ObjectTypeCallProperty>; internalSlots?: Array<ObjectTypeInternalSlot>; exact: boolean; inexact?: boolean | null; } interface ObjectTypeInternalSlot extends BaseNode { type: "ObjectTypeInternalSlot"; id: Identifier; value: FlowType; optional: boolean; static: boolean; method: boolean; } interface ObjectTypeCallProperty extends BaseNode { type: "ObjectTypeCallProperty"; value: FlowType; static: boolean; } interface ObjectTypeIndexer extends BaseNode { type: "ObjectTypeIndexer"; id?: Identifier | null; key: FlowType; value: FlowType; variance?: Variance | null; static: boolean; } interface ObjectTypeProperty extends BaseNode { type: "ObjectTypeProperty"; key: Identifier | StringLiteral; value: FlowType; variance?: Variance | null; kind: "init" | "get" | "set"; method: boolean; optional: boolean; proto: boolean; static: boolean; } interface ObjectTypeSpreadProperty extends BaseNode { type: "ObjectTypeSpreadProperty"; argument: FlowType; } interface OpaqueType extends BaseNode { type: "OpaqueType"; id: Identifier; typeParameters?: TypeParameterDeclaration | null; supertype?: FlowType | null; impltype: FlowType; } interface QualifiedTypeIdentifier extends BaseNode { type: "QualifiedTypeIdentifier"; id: Identifier; qualification: Identifier | QualifiedTypeIdentifier; } interface StringLiteralTypeAnnotation extends BaseNode { type: "StringLiteralTypeAnnotation"; value: string; } interface StringTypeAnnotation extends BaseNode { type: "StringTypeAnnotation"; } interface SymbolTypeAnnotation extends BaseNode { type: "SymbolTypeAnnotation"; } interface ThisTypeAnnotation extends BaseNode { type: "ThisTypeAnnotation"; } interface TupleTypeAnnotation extends BaseNode { type: "TupleTypeAnnotation"; types: Array<FlowType>; } interface TypeofTypeAnnotation extends BaseNode { type: "TypeofTypeAnnotation"; argument: FlowType; } interface TypeAlias extends BaseNode { type: "TypeAlias"; id: Identifier; typeParameters?: TypeParameterDeclaration | null; right: FlowType; } interface TypeAnnotation extends BaseNode { type: "TypeAnnotation"; typeAnnotation: FlowType; } interface TypeCastExpression extends BaseNode { type: "TypeCastExpression"; expression: Expression; typeAnnotation: TypeAnnotation; } interface TypeParameter extends BaseNode { type: "TypeParameter"; bound?: TypeAnnotation | null; default?: FlowType | null; variance?: Variance | null; name: string; } interface TypeParameterDeclaration extends BaseNode { type: "TypeParameterDeclaration"; params: Array<TypeParameter>; } interface TypeParameterInstantiation extends BaseNode { type: "TypeParameterInstantiation"; params: Array<FlowType>; } interface UnionTypeAnnotation extends BaseNode { type: "UnionTypeAnnotation"; types: Array<FlowType>; } interface Variance extends BaseNode { type: "Variance"; kind: "minus" | "plus"; } interface VoidTypeAnnotation extends BaseNode { type: "VoidTypeAnnotation"; } interface EnumDeclaration extends BaseNode { type: "EnumDeclaration"; id: Identifier; body: EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody; } interface EnumBooleanBody extends BaseNode { type: "EnumBooleanBody"; members: Array<EnumBooleanMember>; explicitType: boolean; hasUnknownMembers: boolean; } interface EnumNumberBody extends BaseNode { type: "EnumNumberBody"; members: Array<EnumNumberMember>; explicitType: boolean; hasUnknownMembers: boolean; } interface EnumStringBody extends BaseNode { type: "EnumStringBody"; members: Array<EnumStringMember | EnumDefaultedMember>; explicitType: boolean; hasUnknownMembers: boolean; } interface EnumSymbolBody extends BaseNode { type: "EnumSymbolBody"; members: Array<EnumDefaultedMember>; hasUnknownMembers: boolean; } interface EnumBooleanMember extends BaseNode { type: "EnumBooleanMember"; id: Identifier; init: BooleanLiteral; } interface EnumNumberMember extends BaseNode { type: "EnumNumberMember"; id: Identifier; init: NumericLiteral; } interface EnumStringMember extends BaseNode { type: "EnumStringMember"; id: Identifier; init: StringLiteral; } interface EnumDefaultedMember extends BaseNode { type: "EnumDefaultedMember"; id: Identifier; } interface IndexedAccessType extends BaseNode { type: "IndexedAccessType"; objectType: FlowType; indexType: FlowType; } interface OptionalIndexedAccessType extends BaseNode { type: "OptionalIndexedAccessType"; objectType: FlowType; indexType: FlowType; optional: boolean; } interface JSXAttribute extends BaseNode { type: "JSXAttribute"; name: JSXIdentifier | JSXNamespacedName; value?: JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer | null; } interface JSXClosingElement extends BaseNode { type: "JSXClosingElement"; name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName; } interface JSXElement extends BaseNode { type: "JSXElement"; openingElement: JSXOpeningElement; closingElement?: JSXClosingElement | null; children: Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment>; selfClosing?: boolean | null; } interface JSXEmptyExpression extends BaseNode { type: "JSXEmptyExpression"; } interface JSXExpressionContainer extends BaseNode { type: "JSXExpressionContainer"; expression: Expression | JSXEmptyExpression; } interface JSXSpreadChild extends BaseNode { type: "JSXSpreadChild"; expression: Expression; } interface JSXIdentifier extends BaseNode { type: "JSXIdentifier"; name: string; } interface JSXMemberExpression extends BaseNode { type: "JSXMemberExpression"; object: JSXMemberExpression | JSXIdentifier; property: JSXIdentifier; } interface JSXNamespacedName extends BaseNode { type: "JSXNamespacedName"; namespace: JSXIdentifier; name: JSXIdentifier; } interface JSXOpeningElement extends BaseNode { type: "JSXOpeningElement"; name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName; attributes: Array<JSXAttribute | JSXSpreadAttribute>; selfClosing: boolean; typeParameters?: TypeParameterInstantiation | TSTypeParameterInstantiation | null; } interface JSXSpreadAttribute extends BaseNode { type: "JSXSpreadAttribute"; argument: Expression; } interface JSXText extends BaseNode { type: "JSXText"; value: string; } interface JSXFragment extends BaseNode { type: "JSXFragment"; openingFragment: JSXOpeningFragment; closingFragment: JSXClosingFragment; children: Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment>; } interface JSXOpeningFragment extends BaseNode { type: "JSXOpeningFragment"; } interface JSXClosingFragment extends BaseNode { type: "JSXClosingFragment"; } interface Noop extends BaseNode { type: "Noop"; } interface Placeholder extends BaseNode { type: "Placeholder"; expectedNode: "Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern"; name: Identifier; } interface V8IntrinsicIdentifier extends BaseNode { type: "V8IntrinsicIdentifier"; name: string; } interface ArgumentPlaceholder extends BaseNode { type: "ArgumentPlaceholder"; } interface BindExpression extends BaseNode { type: "BindExpression"; object: Expression; callee: Expression; } interface ImportAttribute extends BaseNode { type: "ImportAttribute"; key: Identifier | StringLiteral; value: StringLiteral; } interface Decorator extends BaseNode { type: "Decorator"; expression: Expression; } interface DoExpression extends BaseNode { type: "DoExpression"; body: BlockStatement; async: boolean; } interface ExportDefaultSpecifier extends BaseNode { type: "ExportDefaultSpecifier"; exported: Identifier; } interface RecordExpression extends BaseNode { type: "RecordExpression"; properties: Array<ObjectProperty | SpreadElement>; } interface TupleExpression extends BaseNode { type: "TupleExpression"; elements: Array<Expression | SpreadElement>; } interface DecimalLiteral extends BaseNode { type: "DecimalLiteral"; value: string; } interface ModuleExpression extends BaseNode { type: "ModuleExpression"; body: Program; } interface TopicReference extends BaseNode { type: "TopicReference"; } interface PipelineTopicExpression extends BaseNode { type: "PipelineTopicExpression"; expression: Expression; } interface PipelineBareFunction extends BaseNode { type: "PipelineBareFunction"; callee: Expression; } interface PipelinePrimaryTopicReference extends BaseNode { type: "PipelinePrimaryTopicReference"; } interface TSParameterProperty extends BaseNode { type: "TSParameterProperty"; parameter: Identifier | AssignmentPattern; accessibility?: "public" | "private" | "protected" | null; decorators?: Array<Decorator> | null; override?: boolean | null; readonly?: boolean | null; } interface TSDeclareFunction extends BaseNode { type: "TSDeclareFunction"; id?: Identifier | null; typeParameters?: TSTypeParameterDeclaration | Noop | null; params: Array<Identifier | Pattern | RestElement>; returnType?: TSTypeAnnotation | Noop | null; async?: boolean; declare?: boolean | null; generator?: boolean; } interface TSDeclareMethod extends BaseNode { type: "TSDeclareMethod"; decorators?: Array<Decorator> | null; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression; typeParameters?: TSTypeParameterDeclaration | Noop | null; params: Array<Identifier | Pattern | RestElement | TSParameterProperty>; returnType?: TSTypeAnnotation | Noop | null; abstract?: boolean | null; access?: "public" | "private" | "protected" | null; accessibility?: "public" | "private" | "protected" | null; async?: boolean; computed?: boolean; generator?: boolean; kind?: "get" | "set" | "method" | "constructor"; optional?: boolean | null; override?: boolean; static?: boolean; } interface TSQualifiedName extends BaseNode { type: "TSQualifiedName"; left: TSEntityName; right: Identifier; } interface TSCallSignatureDeclaration extends BaseNode { type: "TSCallSignatureDeclaration"; typeParameters?: TSTypeParameterDeclaration | null; parameters: Array<Identifier | RestElement>; typeAnnotation?: TSTypeAnnotation | null; } interface TSConstructSignatureDeclaration extends BaseNode { type: "TSConstructSignatureDeclaration"; typeParameters?: TSTypeParameterDeclaration | null; parameters: Array<Identifier | RestElement>; typeAnnotation?: TSTypeAnnotation | null; } interface TSPropertySignature extends BaseNode { type: "TSPropertySignature"; key: Expression; typeAnnotation?: TSTypeAnnotation | null; initializer?: Expression | null; computed?: boolean; kind: "get" | "set"; optional?: boolean | null; readonly?: boolean | null; } interface TSMethodSignature extends BaseNode { type: "TSMethodSignature"; key: Expression; typeParameters?: TSTypeParameterDeclaration | null; parameters: Array<Identifier | RestElement>; typeAnnotation?: TSTypeAnnotation | null; computed?: boolean; kind: "method" | "get" | "set"; optional?: boolean | null; } interface TSIndexSignature extends BaseNode { type: "TSIndexSignature"; parameters: Array<Identifier>; typeAnnotation?: TSTypeAnnotation | null; readonly?: boolean | null; static?: boolean | null; } interface TSAnyKeyword extends BaseNode { type: "TSAnyKeyword"; } interface TSBooleanKeyword extends BaseNode { type: "TSBooleanKeyword"; } interface TSBigIntKeyword extends BaseNode { type: "TSBigIntKeyword"; } interface TSIntrinsicKeyword extends BaseNode { type: "TSIntrinsicKeyword"; } interface TSNeverKeyword extends BaseNode { type: "TSNeverKeyword"; } interface TSNullKeyword extends BaseNode { type: "TSNullKeyword"; } interface TSNumberKeyword extends BaseNode { type: "TSNumberKeyword"; } interface TSObjectKeyword extends BaseNode { type: "TSObjectKeyword"; } interface TSStringKeyword extends BaseNode { type: "TSStringKeyword"; } interface TSSymbolKeyword extends BaseNode { type: "TSSymbolKeyword"; } interface TSUndefinedKeyword extends BaseNode { type: "TSUndefinedKeyword"; } interface TSUnknownKeyword extends BaseNode { type: "TSUnknownKeyword"; } interface TSVoidKeyword extends BaseNode { type: "TSVoidKeyword"; } interface TSThisType extends BaseNode { type: "TSThisType"; } interface TSFunctionType extends BaseNode { type: "TSFunctionType"; typeParameters?: TSTypeParameterDeclaration | null; parameters: Array<Identifier | RestElement>; typeAnnotation?: TSTypeAnnotation | null; } interface TSConstructorType extends BaseNode { type: "TSConstructorType"; typeParameters?: TSTypeParameterDeclaration | null; parameters: Array<Identifier | RestElement>; typeAnnotation?: TSTypeAnnotation | null; abstract?: boolean | null; } interface TSTypeReference extends BaseNode { type: "TSTypeReference"; typeName: TSEntityName; typeParameters?: TSTypeParameterInstantiation | null; } interface TSTypePredicate extends BaseNode { type: "TSTypePredicate"; parameterName: Identifier | TSThisType; typeAnnotation?: TSTypeAnnotation | null; asserts?: boolean | null; } interface TSTypeQuery extends BaseNode { type: "TSTypeQuery"; exprName: TSEntityName | TSImportType; typeParameters?: TSTypeParameterInstantiation | null; } interface TSTypeLiteral extends BaseNode { type: "TSTypeLiteral"; members: Array<TSTypeElement>; } interface TSArrayType extends BaseNode { type: "TSArrayType"; elementType: TSType; } interface TSTupleType extends BaseNode { type: "TSTupleType"; elementTypes: Array<TSType | TSNamedTupleMember>; } interface TSOptionalType extends BaseNode { type: "TSOptionalType"; typeAnnotation: TSType; } interface TSRestType extends BaseNode { type: "TSRestType"; typeAnnotation: TSType; } interface TSNamedTupleMember extends BaseNode { type: "TSNamedTupleMember"; label: Identifier; elementType: TSType; optional: boolean; } interface TSUnionType extends BaseNode { type: "TSUnionType"; types: Array<TSType>; } interface TSIntersectionType extends BaseNode { type: "TSIntersectionType"; types: Array<TSType>; } interface TSConditionalType extends BaseNode { type: "TSConditionalType"; checkType: TSType; extendsType: TSType; trueType: TSType; falseType: TSType; } interface TSInferType extends BaseNode { type: "TSInferType"; typeParameter: TSTypeParameter; } interface TSParenthesizedType extends BaseNode { type: "TSParenthesizedType"; typeAnnotation: TSType; } interface TSTypeOperator extends BaseNode { type: "TSTypeOperator"; typeAnnotation: TSType; operator: string; } interface TSIndexedAccessType extends BaseNode { type: "TSIndexedAccessType"; objectType: TSType; indexType: TSType; } interface TSMappedType extends BaseNode { type: "TSMappedType"; typeParameter: TSTypeParameter; typeAnnotation?: TSType | null; nameType?: TSType | null; optional?: true | false | "+" | "-" | null; readonly?: true | false | "+" | "-" | null; } interface TSLiteralType extends BaseNode { type: "TSLiteralType"; literal: NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TemplateLiteral | UnaryExpression; } interface TSExpressionWithTypeArguments extends BaseNode { type: "TSExpressionWithTypeArguments"; expression: TSEntityName; typeParameters?: TSTypeParameterInstantiation | null; } interface TSInterfaceDeclaration extends BaseNode { type: "TSInterfaceDeclaration"; id: Identifier; typeParameters?: TSTypeParameterDeclaration | null; extends?: Array<TSExpressionWithTypeArguments> | null; body: TSInterfaceBody; declare?: boolean | null; } interface TSInterfaceBody extends BaseNode { type: "TSInterfaceBody"; body: Array<TSTypeElement>; } interface TSTypeAliasDeclaration extends BaseNode { type: "TSTypeAliasDeclaration"; id: Identifier; typeParameters?: TSTypeParameterDeclaration | null; typeAnnotation: TSType; declare?: boolean | null; } interface TSInstantiationExpression extends BaseNode { type: "TSInstantiationExpression"; expression: Expression; typeParameters?: TSTypeParameterInstantiation | null; } interface TSAsExpression extends BaseNode { type: "TSAsExpression"; expression: Expression; typeAnnotation: TSType; } interface TSSatisfiesExpression extends BaseNode { type: "TSSatisfiesExpression"; expression: Expression; typeAnnotation: TSType; } interface TSTypeAssertion extends BaseNode { type: "TSTypeAssertion"; typeAnnotation: TSType; expression: Expression; } interface TSEnumDeclaration extends BaseNode { type: "TSEnumDeclaration"; id: Identifier; members: Array<TSEnumMember>; const?: boolean | null; declare?: boolean | null; initializer?: Expression | null; } interface TSEnumMember extends BaseNode { type: "TSEnumMember"; id: Identifier | StringLiteral; initializer?: Expression | null; } interface TSModuleDeclaration extends BaseNode { type: "TSModuleDeclaration"; id: Identifier | StringLiteral; body: TSModuleBlock | TSModuleDeclaration; declare?: boolean | null; global?: boolean | null; } interface TSModuleBlock extends BaseNode { type: "TSModuleBlock"; body: Array<Statement>; } interface TSImportType extends BaseNode { type: "TSImportType"; argument: StringLiteral; qualifier?: TSEntityName | null; typeParameters?: TSTypeParameterInstantiation | null; } interface TSImportEqualsDeclaration extends BaseNode { type: "TSImportEqualsDeclaration"; id: Identifier; moduleReference: TSEntityName | TSExternalModuleReference; importKind?: "type" | "value" | null; isExport: boolean; } interface TSExternalModuleReference extends BaseNode { type: "TSExternalModuleReference"; expression: StringLiteral; } interface TSNonNullExpression extends BaseNode { type: "TSNonNullExpression"; expression: Expression; } interface TSExportAssignment extends BaseNode { type: "TSExportAssignment"; expression: Expression; } interface TSNamespaceExportDeclaration extends BaseNode { type: "TSNamespaceExportDeclaration"; id: Identifier; } interface TSTypeAnnotation extends BaseNode { type: "TSTypeAnnotation"; typeAnnotation: TSType; } interface TSTypeParameterInstantiation extends BaseNode { type: "TSTypeParameterInstantiation"; params: Array<TSType>; } interface TSTypeParameterDeclaration extends BaseNode { type: "TSTypeParameterDeclaration"; params: Array<TSTypeParameter>; } interface TSTypeParameter extends BaseNode { type: "TSTypeParameter"; constraint?: TSType | null; default?: TSType | null; name: string; const?: boolean | null; in?: boolean | null; out?: boolean | null; } type Standardized = ArrayExpression | AssignmentExpression | BinaryExpression | InterpreterDirective | Directive | DirectiveLiteral | BlockStatement | BreakStatement | CallExpression | CatchClause | Condit