@babel/types

This module contains methods for building ASTs manually and for checking the types of AST nodes.

Install

  • npm
  • Yarn
  • pnpm
  1. npm install --save-dev @babel/types
  1. yarn add --dev @babel/types
  1. pnpm add --save-dev @babel/types

API

Node Builders

anyTypeAnnotation

JavaScript

  1. t.anyTypeAnnotation();

See also t.isAnyTypeAnnotation(node, opts) and t.assertAnyTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


argumentPlaceholder

JavaScript

  1. t.argumentPlaceholder();

See also t.isArgumentPlaceholder(node, opts) and t.assertArgumentPlaceholder(node, opts).


arrayExpression

JavaScript

  1. t.arrayExpression(elements);

See also t.isArrayExpression(node, opts) and t.assertArrayExpression(node, opts).

AST Node ArrayExpression shape:

  • elements: Array<null | Expression | SpreadElement> (default: [])

Aliases: Standardized, Expression


arrayPattern

JavaScript

  1. t.arrayPattern(elements);

See also t.isArrayPattern(node, opts) and t.assertArrayPattern(node, opts).

AST Node ArrayPattern shape:

  • elements: Array<null | PatternLike | LVal> (required)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

Aliases: Standardized, Pattern, PatternLike, LVal


arrayTypeAnnotation

JavaScript

  1. t.arrayTypeAnnotation(elementType);

See also t.isArrayTypeAnnotation(node, opts) and t.assertArrayTypeAnnotation(node, opts).

AST Node ArrayTypeAnnotation shape:

  • elementType: FlowType (required)

Aliases: Flow, FlowType


arrowFunctionExpression

JavaScript

  1. t.arrowFunctionExpression(params, body, async);

See also t.isArrowFunctionExpression(node, opts) and t.assertArrowFunctionExpression(node, opts).

AST Node ArrowFunctionExpression shape:

  • params: Array<Identifier | Pattern | RestElement> (required)
  • body: BlockStatement | Expression (required)
  • async: boolean (default: false)
  • expression: boolean (required)
  • generator: boolean (default: false, excluded from builder function)
  • predicate: DeclaredPredicate | InferredPredicate (default: null, excluded from builder function)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, Scopable, Function, BlockParent, FunctionParent, Expression, Pureish


assignmentExpression

JavaScript

  1. t.assignmentExpression(operator, left, right);

See also t.isAssignmentExpression(node, opts) and t.assertAssignmentExpression(node, opts).

AST Node AssignmentExpression shape:

  • operator: string (required)
  • left: LVal | OptionalMemberExpression (required)
  • right: Expression (required)

Aliases: Standardized, Expression


assignmentPattern

JavaScript

  1. t.assignmentPattern(left, right);

See also t.isAssignmentPattern(node, opts) and t.assertAssignmentPattern(node, opts).

AST Node AssignmentPattern shape:

  • left: Identifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression (required)
  • right: Expression (required)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

Aliases: Standardized, Pattern, PatternLike, LVal


awaitExpression

JavaScript

  1. t.awaitExpression(argument);

See also t.isAwaitExpression(node, opts) and t.assertAwaitExpression(node, opts).

AST Node AwaitExpression shape:

  • argument: Expression (required)

Aliases: Standardized, Expression, Terminatorless


bigIntLiteral

JavaScript

  1. t.bigIntLiteral(value);

See also t.isBigIntLiteral(node, opts) and t.assertBigIntLiteral(node, opts).

AST Node BigIntLiteral shape:

  • value: string (required)

Aliases: Standardized, Expression, Pureish, Literal, Immutable


binaryExpression

JavaScript

  1. t.binaryExpression(operator, left, right);

See also t.isBinaryExpression(node, opts) and t.assertBinaryExpression(node, opts).

AST Node BinaryExpression shape:

  • operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>" (required)
  • left: Expression | PrivateName (required)
  • right: Expression (required)

Aliases: Standardized, Binary, Expression


bindExpression

JavaScript

  1. t.bindExpression(object, callee);

See also t.isBindExpression(node, opts) and t.assertBindExpression(node, opts).

AST Node BindExpression shape:

  • object: Expression (required)
  • callee: Expression (required)

Aliases: Expression


blockStatement

JavaScript

  1. t.blockStatement(body, directives);

See also t.isBlockStatement(node, opts) and t.assertBlockStatement(node, opts).

AST Node BlockStatement shape:

  • body: Array<Statement> (required)
  • directives: Array<Directive> (default: [])

Aliases: Standardized, Scopable, BlockParent, Block, Statement


booleanLiteral

JavaScript

  1. t.booleanLiteral(value);

See also t.isBooleanLiteral(node, opts) and t.assertBooleanLiteral(node, opts).

AST Node BooleanLiteral shape:

  • value: boolean (required)

Aliases: Standardized, Expression, Pureish, Literal, Immutable


booleanLiteralTypeAnnotation

JavaScript

  1. t.booleanLiteralTypeAnnotation(value);

See also t.isBooleanLiteralTypeAnnotation(node, opts) and t.assertBooleanLiteralTypeAnnotation(node, opts).

AST Node BooleanLiteralTypeAnnotation shape:

  • value: boolean (required)

Aliases: Flow, FlowType


booleanTypeAnnotation

JavaScript

  1. t.booleanTypeAnnotation();

See also t.isBooleanTypeAnnotation(node, opts) and t.assertBooleanTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


breakStatement

JavaScript

  1. t.breakStatement(label);

See also t.isBreakStatement(node, opts) and t.assertBreakStatement(node, opts).

AST Node BreakStatement shape:

  • label: Identifier (default: null)

Aliases: Standardized, Statement, Terminatorless, CompletionStatement


callExpression

JavaScript

  1. t.callExpression(callee, arguments);

See also t.isCallExpression(node, opts) and t.assertCallExpression(node, opts).

AST Node CallExpression shape:

  • callee: Expression | Super | V8IntrinsicIdentifier (required)
  • arguments: Array<Expression | SpreadElement | ArgumentPlaceholder> (required)
  • optional: boolean (default: null, excluded from builder function)
  • typeArguments: TypeParameterInstantiation (default: null, excluded from builder function)
  • typeParameters: TSTypeParameterInstantiation (default: null, excluded from builder function)

Aliases: Standardized, Expression


catchClause

JavaScript

  1. t.catchClause(param, body);

See also t.isCatchClause(node, opts) and t.assertCatchClause(node, opts).

AST Node CatchClause shape:

  • param: Identifier | ArrayPattern | ObjectPattern (default: null)
  • body: BlockStatement (required)

Aliases: Standardized, Scopable, BlockParent


classAccessorProperty

JavaScript

  1. t.classAccessorProperty(key, value, typeAnnotation, decorators, computed, static);

See also t.isClassAccessorProperty(node, opts) and t.assertClassAccessorProperty(node, opts).

AST Node ClassAccessorProperty shape:

  • key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName (required)
  • value: Expression (default: null)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null)
  • decorators: Array<Decorator> (default: null)
  • computed: boolean (default: false)
  • static: boolean (default: false)
  • abstract: boolean (default: null, excluded from builder function)
  • accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)
  • declare: boolean (default: null, excluded from builder function)
  • definite: boolean (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • override: boolean (default: false, excluded from builder function)
  • readonly: boolean (default: null, excluded from builder function)
  • variance: Variance (default: null, excluded from builder function)

Aliases: Standardized, Property, Accessor


classBody

JavaScript

  1. t.classBody(body);

See also t.isClassBody(node, opts) and t.assertClassBody(node, opts).

AST Node ClassBody shape:

  • body: Array<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock> (required)

Aliases: Standardized


classDeclaration

JavaScript

  1. t.classDeclaration(id, superClass, body, decorators);

See also t.isClassDeclaration(node, opts) and t.assertClassDeclaration(node, opts).

AST Node ClassDeclaration shape:

  • id: Identifier (default: null)
  • superClass: Expression (default: null)
  • body: ClassBody (required)
  • decorators: Array<Decorator> (default: null)
  • abstract: boolean (default: null, excluded from builder function)
  • declare: boolean (default: null, excluded from builder function)
  • implements: Array<TSExpressionWithTypeArguments | ClassImplements> (default: null, excluded from builder function)
  • mixins: InterfaceExtends (default: null, excluded from builder function)
  • superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, Scopable, Class, Statement, Declaration


classExpression

JavaScript

  1. t.classExpression(id, superClass, body, decorators);

See also t.isClassExpression(node, opts) and t.assertClassExpression(node, opts).

AST Node ClassExpression shape:

  • id: Identifier (default: null)
  • superClass: Expression (default: null)
  • body: ClassBody (required)
  • decorators: Array<Decorator> (default: null)
  • implements: Array<TSExpressionWithTypeArguments | ClassImplements> (default: null, excluded from builder function)
  • mixins: InterfaceExtends (default: null, excluded from builder function)
  • superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, Scopable, Class, Expression


classImplements

JavaScript

  1. t.classImplements(id, typeParameters);

See also t.isClassImplements(node, opts) and t.assertClassImplements(node, opts).

AST Node ClassImplements shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterInstantiation (default: null)

Aliases: Flow


classMethod

JavaScript

  1. t.classMethod(kind, key, params, body, computed, static, generator, async);

See also t.isClassMethod(node, opts) and t.assertClassMethod(node, opts).

AST Node ClassMethod shape:

  • kind: "get" | "set" | "method" | "constructor" (default: 'method')
  • key: if computed then Expression else Identifier | Literal (required)
  • params: Array<Identifier | Pattern | RestElement | TSParameterProperty> (required)
  • body: BlockStatement (required)
  • computed: boolean (default: false)
  • static: boolean (default: false)
  • generator: boolean (default: false)
  • async: boolean (default: false)
  • abstract: boolean (default: null, excluded from builder function)
  • access: "public" | "private" | "protected" (default: null, excluded from builder function)
  • accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • override: boolean (default: false, excluded from builder function)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, Function, Scopable, BlockParent, FunctionParent, Method


classPrivateMethod

JavaScript

  1. t.classPrivateMethod(kind, key, params, body, static);

See also t.isClassPrivateMethod(node, opts) and t.assertClassPrivateMethod(node, opts).

AST Node ClassPrivateMethod shape:

  • kind: "get" | "set" | "method" (default: 'method')
  • key: PrivateName (required)
  • params: Array<Identifier | Pattern | RestElement | TSParameterProperty> (required)
  • body: BlockStatement (required)
  • static: boolean (default: false)
  • abstract: boolean (default: null, excluded from builder function)
  • access: "public" | "private" | "protected" (default: null, excluded from builder function)
  • accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)
  • async: boolean (default: false, excluded from builder function)
  • computed: ‘false’ (default: false, excluded from builder function)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • generator: boolean (default: false, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • override: boolean (default: false, excluded from builder function)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, Function, Scopable, BlockParent, FunctionParent, Method, Private


classPrivateProperty

JavaScript

  1. t.classPrivateProperty(key, value, decorators, static);

See also t.isClassPrivateProperty(node, opts) and t.assertClassPrivateProperty(node, opts).

AST Node ClassPrivateProperty shape:

  • key: PrivateName (required)
  • value: Expression (default: null)
  • decorators: Array<Decorator> (default: null)
  • static: boolean (default: false)
  • definite: boolean (default: null, excluded from builder function)
  • readonly: boolean (default: null, excluded from builder function)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)
  • variance: Variance (default: null, excluded from builder function)

Aliases: Standardized, Property, Private


classProperty

JavaScript

  1. t.classProperty(key, value, typeAnnotation, decorators, computed, static);

History

VersionChanges
v7.6.0Supports static

See also t.isClassProperty(node, opts) and t.assertClassProperty(node, opts).

AST Node ClassProperty shape:

  • key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression (required)
  • value: Expression (default: null)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null)
  • decorators: Array<Decorator> (default: null)
  • computed: boolean (default: false)
  • static: boolean (default: false)
  • abstract: boolean (default: null, excluded from builder function)
  • accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)
  • declare: boolean (default: null, excluded from builder function)
  • definite: boolean (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • override: boolean (default: false, excluded from builder function)
  • readonly: boolean (default: null, excluded from builder function)
  • variance: Variance (default: null, excluded from builder function)

Aliases: Standardized, Property


conditionalExpression

JavaScript

  1. t.conditionalExpression(test, consequent, alternate);

See also t.isConditionalExpression(node, opts) and t.assertConditionalExpression(node, opts).

AST Node ConditionalExpression shape:

  • test: Expression (required)
  • consequent: Expression (required)
  • alternate: Expression (required)

Aliases: Standardized, Expression, Conditional


continueStatement

JavaScript

  1. t.continueStatement(label);

See also t.isContinueStatement(node, opts) and t.assertContinueStatement(node, opts).

AST Node ContinueStatement shape:

  • label: Identifier (default: null)

Aliases: Standardized, Statement, Terminatorless, CompletionStatement


debuggerStatement

JavaScript

  1. t.debuggerStatement();

See also t.isDebuggerStatement(node, opts) and t.assertDebuggerStatement(node, opts).

Aliases: Standardized, Statement


decimalLiteral

JavaScript

  1. t.decimalLiteral(value);

See also t.isDecimalLiteral(node, opts) and t.assertDecimalLiteral(node, opts).

AST Node DecimalLiteral shape:

  • value: string (required)

Aliases: Expression, Pureish, Literal, Immutable


declareClass

JavaScript

  1. t.declareClass(id, typeParameters, extends, body);

See also t.isDeclareClass(node, opts) and t.assertDeclareClass(node, opts).

AST Node DeclareClass shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterDeclaration (default: null)
  • extends: Array<InterfaceExtends> (default: null)
  • body: ObjectTypeAnnotation (required)
  • implements: Array<ClassImplements> (default: null, excluded from builder function)
  • mixins: Array<InterfaceExtends> (default: null, excluded from builder function)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareExportAllDeclaration

JavaScript

  1. t.declareExportAllDeclaration(source);

See also t.isDeclareExportAllDeclaration(node, opts) and t.assertDeclareExportAllDeclaration(node, opts).

AST Node DeclareExportAllDeclaration shape:

  • source: StringLiteral (required)
  • exportKind: "type" | "value" (default: null, excluded from builder function)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareExportDeclaration

JavaScript

  1. t.declareExportDeclaration(declaration, specifiers, source);

See also t.isDeclareExportDeclaration(node, opts) and t.assertDeclareExportDeclaration(node, opts).

AST Node DeclareExportDeclaration shape:

  • declaration: Flow (default: null)
  • specifiers: Array<ExportSpecifier | ExportNamespaceSpecifier> (default: null)
  • source: StringLiteral (default: null)
  • default: boolean (default: null, excluded from builder function)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareFunction

JavaScript

  1. t.declareFunction(id);

See also t.isDeclareFunction(node, opts) and t.assertDeclareFunction(node, opts).

AST Node DeclareFunction shape:

  • id: Identifier (required)
  • predicate: DeclaredPredicate (default: null, excluded from builder function)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareInterface

JavaScript

  1. t.declareInterface(id, typeParameters, extends, body);

See also t.isDeclareInterface(node, opts) and t.assertDeclareInterface(node, opts).

AST Node DeclareInterface shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterDeclaration (default: null)
  • extends: Array<InterfaceExtends> (default: null)
  • body: ObjectTypeAnnotation (required)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareModule

JavaScript

  1. t.declareModule(id, body, kind);

See also t.isDeclareModule(node, opts) and t.assertDeclareModule(node, opts).

AST Node DeclareModule shape:

  • id: Identifier | StringLiteral (required)
  • body: BlockStatement (required)
  • kind: "CommonJS" | "ES" (default: null)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareModuleExports

JavaScript

  1. t.declareModuleExports(typeAnnotation);

See also t.isDeclareModuleExports(node, opts) and t.assertDeclareModuleExports(node, opts).

AST Node DeclareModuleExports shape:

  • typeAnnotation: TypeAnnotation (required)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareOpaqueType

JavaScript

  1. t.declareOpaqueType(id, typeParameters, supertype);

See also t.isDeclareOpaqueType(node, opts) and t.assertDeclareOpaqueType(node, opts).

AST Node DeclareOpaqueType shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterDeclaration (default: null)
  • supertype: FlowType (default: null)
  • impltype: FlowType (default: null, excluded from builder function)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareTypeAlias

JavaScript

  1. t.declareTypeAlias(id, typeParameters, right);

See also t.isDeclareTypeAlias(node, opts) and t.assertDeclareTypeAlias(node, opts).

AST Node DeclareTypeAlias shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterDeclaration (default: null)
  • right: FlowType (required)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declareVariable

JavaScript

  1. t.declareVariable(id);

See also t.isDeclareVariable(node, opts) and t.assertDeclareVariable(node, opts).

AST Node DeclareVariable shape:

  • id: Identifier (required)

Aliases: Flow, FlowDeclaration, Statement, Declaration


declaredPredicate

JavaScript

  1. t.declaredPredicate(value);

See also t.isDeclaredPredicate(node, opts) and t.assertDeclaredPredicate(node, opts).

AST Node DeclaredPredicate shape:

  • value: Flow (required)

Aliases: Flow, FlowPredicate


decorator

JavaScript

  1. t.decorator(expression);

See also t.isDecorator(node, opts) and t.assertDecorator(node, opts).

AST Node Decorator shape:

  • expression: Expression (required)

directive

JavaScript

  1. t.directive(value);

See also t.isDirective(node, opts) and t.assertDirective(node, opts).

AST Node Directive shape:

  • value: DirectiveLiteral (required)

Aliases: Standardized


directiveLiteral

JavaScript

  1. t.directiveLiteral(value);

See also t.isDirectiveLiteral(node, opts) and t.assertDirectiveLiteral(node, opts).

AST Node DirectiveLiteral shape:

  • value: string (required)

Aliases: Standardized


doExpression

JavaScript

  1. t.doExpression(body, async);

See also t.isDoExpression(node, opts) and t.assertDoExpression(node, opts).

AST Node DoExpression shape:

  • body: BlockStatement (required)
  • async: boolean (default: false)

Aliases: Expression


doWhileStatement

JavaScript

  1. t.doWhileStatement(test, body);

See also t.isDoWhileStatement(node, opts) and t.assertDoWhileStatement(node, opts).

AST Node DoWhileStatement shape:

  • test: Expression (required)
  • body: Statement (required)

Aliases: Standardized, Statement, BlockParent, Loop, While, Scopable


emptyStatement

JavaScript

  1. t.emptyStatement();

See also t.isEmptyStatement(node, opts) and t.assertEmptyStatement(node, opts).

Aliases: Standardized, Statement


emptyTypeAnnotation

JavaScript

  1. t.emptyTypeAnnotation();

See also t.isEmptyTypeAnnotation(node, opts) and t.assertEmptyTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


enumBooleanBody

JavaScript

  1. t.enumBooleanBody(members);

See also t.isEnumBooleanBody(node, opts) and t.assertEnumBooleanBody(node, opts).

AST Node EnumBooleanBody shape:

  • members: Array<EnumBooleanMember> (required)
  • explicitType: boolean (required)
  • hasUnknownMembers: boolean (required)

Aliases: Flow, EnumBody


enumBooleanMember

JavaScript

  1. t.enumBooleanMember(id);

See also t.isEnumBooleanMember(node, opts) and t.assertEnumBooleanMember(node, opts).

AST Node EnumBooleanMember shape:

  • id: Identifier (required)
  • init: BooleanLiteral (required)

Aliases: Flow, EnumMember


enumDeclaration

JavaScript

  1. t.enumDeclaration(id, body);

See also t.isEnumDeclaration(node, opts) and t.assertEnumDeclaration(node, opts).

AST Node EnumDeclaration shape:

  • id: Identifier (required)
  • body: EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody (required)

Aliases: Flow, Statement, Declaration


enumDefaultedMember

JavaScript

  1. t.enumDefaultedMember(id);

See also t.isEnumDefaultedMember(node, opts) and t.assertEnumDefaultedMember(node, opts).

AST Node EnumDefaultedMember shape:

  • id: Identifier (required)

Aliases: Flow, EnumMember


enumNumberBody

JavaScript

  1. t.enumNumberBody(members);

See also t.isEnumNumberBody(node, opts) and t.assertEnumNumberBody(node, opts).

AST Node EnumNumberBody shape:

  • members: Array<EnumNumberMember> (required)
  • explicitType: boolean (required)
  • hasUnknownMembers: boolean (required)

Aliases: Flow, EnumBody


enumNumberMember

JavaScript

  1. t.enumNumberMember(id, init);

See also t.isEnumNumberMember(node, opts) and t.assertEnumNumberMember(node, opts).

AST Node EnumNumberMember shape:

  • id: Identifier (required)
  • init: NumericLiteral (required)

Aliases: Flow, EnumMember


enumStringBody

JavaScript

  1. t.enumStringBody(members);

See also t.isEnumStringBody(node, opts) and t.assertEnumStringBody(node, opts).

AST Node EnumStringBody shape:

  • members: Array<EnumStringMember | EnumDefaultedMember> (required)
  • explicitType: boolean (required)
  • hasUnknownMembers: boolean (required)

Aliases: Flow, EnumBody


enumStringMember

JavaScript

  1. t.enumStringMember(id, init);

See also t.isEnumStringMember(node, opts) and t.assertEnumStringMember(node, opts).

AST Node EnumStringMember shape:

  • id: Identifier (required)
  • init: StringLiteral (required)

Aliases: Flow, EnumMember


enumSymbolBody

JavaScript

  1. t.enumSymbolBody(members);

See also t.isEnumSymbolBody(node, opts) and t.assertEnumSymbolBody(node, opts).

AST Node EnumSymbolBody shape:

  • members: Array<EnumDefaultedMember> (required)
  • hasUnknownMembers: boolean (required)

Aliases: Flow, EnumBody


existsTypeAnnotation

JavaScript

  1. t.existsTypeAnnotation();

See also t.isExistsTypeAnnotation(node, opts) and t.assertExistsTypeAnnotation(node, opts).

Aliases: Flow, FlowType


exportAllDeclaration

JavaScript

  1. t.exportAllDeclaration(source);

See also t.isExportAllDeclaration(node, opts) and t.assertExportAllDeclaration(node, opts).

AST Node ExportAllDeclaration shape:

  • source: StringLiteral (required)
  • assertions: Array<ImportAttribute> (default: null, excluded from builder function)
  • attributes: Array<ImportAttribute> (default: null, excluded from builder function)
  • exportKind: "type" | "value" (default: null, excluded from builder function)

Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportDefaultDeclaration

JavaScript

  1. t.exportDefaultDeclaration(declaration);

See also t.isExportDefaultDeclaration(node, opts) and t.assertExportDefaultDeclaration(node, opts).

AST Node ExportDefaultDeclaration shape:

  • declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression (required)
  • exportKind: "value" (default: null, excluded from builder function)

Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportDefaultSpecifier

JavaScript

  1. t.exportDefaultSpecifier(exported);

See also t.isExportDefaultSpecifier(node, opts) and t.assertExportDefaultSpecifier(node, opts).

AST Node ExportDefaultSpecifier shape:

  • exported: Identifier (required)

Aliases: ModuleSpecifier


exportNamedDeclaration

JavaScript

  1. t.exportNamedDeclaration(declaration, specifiers, source);

See also t.isExportNamedDeclaration(node, opts) and t.assertExportNamedDeclaration(node, opts).

AST Node ExportNamedDeclaration shape:

  • declaration: Declaration (default: null)
  • specifiers: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier> (default: [])
  • source: StringLiteral (default: null)
  • assertions: Array<ImportAttribute> (default: null, excluded from builder function)
  • attributes: Array<ImportAttribute> (default: null, excluded from builder function)
  • exportKind: "type" | "value" (default: null, excluded from builder function)

Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportNamespaceSpecifier

JavaScript

  1. t.exportNamespaceSpecifier(exported);

See also t.isExportNamespaceSpecifier(node, opts) and t.assertExportNamespaceSpecifier(node, opts).

AST Node ExportNamespaceSpecifier shape:

  • exported: Identifier (required)

Aliases: Standardized, ModuleSpecifier


exportSpecifier

JavaScript

  1. t.exportSpecifier(local, exported);

See also t.isExportSpecifier(node, opts) and t.assertExportSpecifier(node, opts).

AST Node ExportSpecifier shape:

  • local: Identifier (required)
  • exported: Identifier | StringLiteral (required)
  • exportKind: "type" | "value" (default: null, excluded from builder function)

Aliases: Standardized, ModuleSpecifier


expressionStatement

JavaScript

  1. t.expressionStatement(expression);

See also t.isExpressionStatement(node, opts) and t.assertExpressionStatement(node, opts).

AST Node ExpressionStatement shape:

  • expression: Expression (required)

Aliases: Standardized, Statement, ExpressionWrapper


file

JavaScript

  1. t.file(program, comments, tokens);

See also t.isFile(node, opts) and t.assertFile(node, opts).

AST Node File shape:

  • program: Program (required)
  • comments: Array<CommentBlock | CommentLine> (default: null)
  • tokens: Array<any> (default: null)

Aliases: Standardized


forInStatement

JavaScript

  1. t.forInStatement(left, right, body);

See also t.isForInStatement(node, opts) and t.assertForInStatement(node, opts).

AST Node ForInStatement shape:

  • left: VariableDeclaration | LVal (required)
  • right: Expression (required)
  • body: Statement (required)

Aliases: Standardized, Scopable, Statement, For, BlockParent, Loop, ForXStatement


forOfStatement

JavaScript

  1. t.forOfStatement(left, right, body, await);

See also t.isForOfStatement(node, opts) and t.assertForOfStatement(node, opts).

AST Node ForOfStatement shape:

  • left: VariableDeclaration | LVal (required)
  • right: Expression (required)
  • body: Statement (required)
  • await: boolean (default: false)

Aliases: Standardized, Scopable, Statement, For, BlockParent, Loop, ForXStatement


forStatement

JavaScript

  1. t.forStatement(init, test, update, body);

See also t.isForStatement(node, opts) and t.assertForStatement(node, opts).

AST Node ForStatement shape:

  • init: VariableDeclaration | Expression (default: null)
  • test: Expression (default: null)
  • update: Expression (default: null)
  • body: Statement (required)

Aliases: Standardized, Scopable, Statement, For, BlockParent, Loop


functionDeclaration

JavaScript

  1. t.functionDeclaration(id, params, body, generator, async);

See also t.isFunctionDeclaration(node, opts) and t.assertFunctionDeclaration(node, opts).

AST Node FunctionDeclaration shape:

  • id: Identifier (default: null)
  • params: Array<Identifier | Pattern | RestElement> (required)
  • body: BlockStatement (required)
  • generator: boolean (default: false)
  • async: boolean (default: false)
  • declare: boolean (default: null, excluded from builder function)
  • predicate: DeclaredPredicate | InferredPredicate (default: null, excluded from builder function)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, Scopable, Function, BlockParent, FunctionParent, Statement, Pureish, Declaration


functionExpression

JavaScript

  1. t.functionExpression(id, params, body, generator, async);

See also t.isFunctionExpression(node, opts) and t.assertFunctionExpression(node, opts).

AST Node FunctionExpression shape:

  • id: Identifier (default: null)
  • params: Array<Identifier | Pattern | RestElement> (required)
  • body: BlockStatement (required)
  • generator: boolean (default: false)
  • async: boolean (default: false)
  • predicate: DeclaredPredicate | InferredPredicate (default: null, excluded from builder function)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, Scopable, Function, BlockParent, FunctionParent, Expression, Pureish


functionTypeAnnotation

JavaScript

  1. t.functionTypeAnnotation(typeParameters, params, rest, returnType);

See also t.isFunctionTypeAnnotation(node, opts) and t.assertFunctionTypeAnnotation(node, opts).

AST Node FunctionTypeAnnotation shape:

  • typeParameters: TypeParameterDeclaration (default: null)
  • params: Array<FunctionTypeParam> (required)
  • rest: FunctionTypeParam (default: null)
  • returnType: FlowType (required)
  • this: FunctionTypeParam (default: null, excluded from builder function)

Aliases: Flow, FlowType


functionTypeParam

JavaScript

  1. t.functionTypeParam(name, typeAnnotation);

See also t.isFunctionTypeParam(node, opts) and t.assertFunctionTypeParam(node, opts).

AST Node FunctionTypeParam shape:

  • name: Identifier (default: null)
  • typeAnnotation: FlowType (required)
  • optional: boolean (default: null, excluded from builder function)

Aliases: Flow


genericTypeAnnotation

JavaScript

  1. t.genericTypeAnnotation(id, typeParameters);

See also t.isGenericTypeAnnotation(node, opts) and t.assertGenericTypeAnnotation(node, opts).

AST Node GenericTypeAnnotation shape:

  • id: Identifier | QualifiedTypeIdentifier (required)
  • typeParameters: TypeParameterInstantiation (default: null)

Aliases: Flow, FlowType


identifier

JavaScript

  1. t.identifier(name);

See also t.isIdentifier(node, opts) and t.assertIdentifier(node, opts).

AST Node Identifier shape:

  • name: string (required)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

Aliases: Standardized, Expression, PatternLike, LVal, TSEntityName


ifStatement

JavaScript

  1. t.ifStatement(test, consequent, alternate);

See also t.isIfStatement(node, opts) and t.assertIfStatement(node, opts).

AST Node IfStatement shape:

  • test: Expression (required)
  • consequent: Statement (required)
  • alternate: Statement (default: null)

Aliases: Standardized, Statement, Conditional


import

JavaScript

  1. t.import();

See also t.isImport(node, opts) and t.assertImport(node, opts).

Aliases: Standardized, Expression


importAttribute

JavaScript

  1. t.importAttribute(key, value);

See also t.isImportAttribute(node, opts) and t.assertImportAttribute(node, opts).

AST Node ImportAttribute shape:

  • key: Identifier | StringLiteral (required)
  • value: StringLiteral (required)

importDeclaration

JavaScript

  1. t.importDeclaration(specifiers, source);

History

VersionChanges
v7.20.0Supports module

See also t.isImportDeclaration(node, opts) and t.assertImportDeclaration(node, opts).

AST Node ImportDeclaration shape:

  • specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier> (required)
  • source: StringLiteral (required)
  • assertions: Array<ImportAttribute> (default: null, excluded from builder function)
  • attributes: Array<ImportAttribute> (default: null, excluded from builder function)
  • importKind: "type" | "typeof" | "value" (default: null, excluded from builder function)
  • module: boolean (default: null, excluded from builder function)
  • phase: "source" | "defer" (default: null, excluded from builder function)

Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration


importDefaultSpecifier

JavaScript

  1. t.importDefaultSpecifier(local);

See also t.isImportDefaultSpecifier(node, opts) and t.assertImportDefaultSpecifier(node, opts).

AST Node ImportDefaultSpecifier shape:

  • local: Identifier (required)

Aliases: Standardized, ModuleSpecifier


importExpression

JavaScript

  1. t.importExpression(source, options);

See also t.isImportExpression(node, opts) and t.assertImportExpression(node, opts).

AST Node ImportExpression shape:

  • source: Expression (required)
  • options: Expression (default: null)
  • phase: "source" | "defer" (default: null, excluded from builder function)

Aliases: Standardized, Expression


importNamespaceSpecifier

JavaScript

  1. t.importNamespaceSpecifier(local);

See also t.isImportNamespaceSpecifier(node, opts) and t.assertImportNamespaceSpecifier(node, opts).

AST Node ImportNamespaceSpecifier shape:

  • local: Identifier (required)

Aliases: Standardized, ModuleSpecifier


importSpecifier

JavaScript

  1. t.importSpecifier(local, imported);

See also t.isImportSpecifier(node, opts) and t.assertImportSpecifier(node, opts).

AST Node ImportSpecifier shape:

  • local: Identifier (required)
  • imported: Identifier | StringLiteral (required)
  • importKind: "type" | "typeof" | "value" (default: null, excluded from builder function)

Aliases: Standardized, ModuleSpecifier


indexedAccessType

JavaScript

  1. t.indexedAccessType(objectType, indexType);

See also t.isIndexedAccessType(node, opts) and t.assertIndexedAccessType(node, opts).

AST Node IndexedAccessType shape:

  • objectType: FlowType (required)
  • indexType: FlowType (required)

Aliases: Flow, FlowType


inferredPredicate

JavaScript

  1. t.inferredPredicate();

See also t.isInferredPredicate(node, opts) and t.assertInferredPredicate(node, opts).

Aliases: Flow, FlowPredicate


interfaceDeclaration

JavaScript

  1. t.interfaceDeclaration(id, typeParameters, extends, body);

See also t.isInterfaceDeclaration(node, opts) and t.assertInterfaceDeclaration(node, opts).

AST Node InterfaceDeclaration shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterDeclaration (default: null)
  • extends: Array<InterfaceExtends> (default: null)
  • body: ObjectTypeAnnotation (required)

Aliases: Flow, FlowDeclaration, Statement, Declaration


interfaceExtends

JavaScript

  1. t.interfaceExtends(id, typeParameters);

See also t.isInterfaceExtends(node, opts) and t.assertInterfaceExtends(node, opts).

AST Node InterfaceExtends shape:

  • id: Identifier | QualifiedTypeIdentifier (required)
  • typeParameters: TypeParameterInstantiation (default: null)

Aliases: Flow


interfaceTypeAnnotation

JavaScript

  1. t.interfaceTypeAnnotation(extends, body);

See also t.isInterfaceTypeAnnotation(node, opts) and t.assertInterfaceTypeAnnotation(node, opts).

AST Node InterfaceTypeAnnotation shape:

  • extends: Array<InterfaceExtends> (default: null)
  • body: ObjectTypeAnnotation (required)

Aliases: Flow, FlowType


interpreterDirective

JavaScript

  1. t.interpreterDirective(value);

See also t.isInterpreterDirective(node, opts) and t.assertInterpreterDirective(node, opts).

AST Node InterpreterDirective shape:

  • value: string (required)

Aliases: Standardized


intersectionTypeAnnotation

JavaScript

  1. t.intersectionTypeAnnotation(types);

See also t.isIntersectionTypeAnnotation(node, opts) and t.assertIntersectionTypeAnnotation(node, opts).

AST Node IntersectionTypeAnnotation shape:

  • types: Array<FlowType> (required)

Aliases: Flow, FlowType


jsxAttribute

JavaScript

  1. t.jsxAttribute(name, value);

See also t.isJSXAttribute(node, opts) and t.assertJSXAttribute(node, opts).

AST Node JSXAttribute shape:

  • name: JSXIdentifier | JSXNamespacedName (required)
  • value: JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer (default: null)

Aliases: JSX, Immutable


jsxClosingElement

JavaScript

  1. t.jsxClosingElement(name);

See also t.isJSXClosingElement(node, opts) and t.assertJSXClosingElement(node, opts).

AST Node JSXClosingElement shape:

  • name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName (required)

Aliases: JSX, Immutable


jsxClosingFragment

JavaScript

  1. t.jsxClosingFragment();

See also t.isJSXClosingFragment(node, opts) and t.assertJSXClosingFragment(node, opts).

Aliases: JSX, Immutable


jsxElement

JavaScript

  1. t.jsxElement(openingElement, closingElement, children, selfClosing);

See also t.isJSXElement(node, opts) and t.assertJSXElement(node, opts).

AST Node JSXElement shape:

  • openingElement: JSXOpeningElement (required)
  • closingElement: JSXClosingElement (default: null)
  • children: Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment> (required)
  • selfClosing: boolean (default: null)

Aliases: JSX, Immutable, Expression


jsxEmptyExpression

JavaScript

  1. t.jsxEmptyExpression();

See also t.isJSXEmptyExpression(node, opts) and t.assertJSXEmptyExpression(node, opts).

Aliases: JSX


jsxExpressionContainer

JavaScript

  1. t.jsxExpressionContainer(expression);

See also t.isJSXExpressionContainer(node, opts) and t.assertJSXExpressionContainer(node, opts).

AST Node JSXExpressionContainer shape:

  • expression: Expression | JSXEmptyExpression (required)

Aliases: JSX, Immutable


jsxFragment

JavaScript

  1. t.jsxFragment(openingFragment, closingFragment, children);

See also t.isJSXFragment(node, opts) and t.assertJSXFragment(node, opts).

AST Node JSXFragment shape:

  • openingFragment: JSXOpeningFragment (required)
  • closingFragment: JSXClosingFragment (required)
  • children: Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment> (required)

Aliases: JSX, Immutable, Expression


jsxIdentifier

JavaScript

  1. t.jsxIdentifier(name);

See also t.isJSXIdentifier(node, opts) and t.assertJSXIdentifier(node, opts).

AST Node JSXIdentifier shape:

  • name: string (required)

Aliases: JSX


jsxMemberExpression

JavaScript

  1. t.jsxMemberExpression(object, property);

See also t.isJSXMemberExpression(node, opts) and t.assertJSXMemberExpression(node, opts).

AST Node JSXMemberExpression shape:

  • object: JSXMemberExpression | JSXIdentifier (required)
  • property: JSXIdentifier (required)

Aliases: JSX


jsxNamespacedName

JavaScript

  1. t.jsxNamespacedName(namespace, name);

See also t.isJSXNamespacedName(node, opts) and t.assertJSXNamespacedName(node, opts).

AST Node JSXNamespacedName shape:

  • namespace: JSXIdentifier (required)
  • name: JSXIdentifier (required)

Aliases: JSX


jsxOpeningElement

JavaScript

  1. t.jsxOpeningElement(name, attributes, selfClosing);

See also t.isJSXOpeningElement(node, opts) and t.assertJSXOpeningElement(node, opts).

AST Node JSXOpeningElement shape:

  • name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName (required)
  • attributes: Array<JSXAttribute | JSXSpreadAttribute> (required)
  • selfClosing: boolean (default: false)
  • typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)

Aliases: JSX, Immutable


jsxOpeningFragment

JavaScript

  1. t.jsxOpeningFragment();

See also t.isJSXOpeningFragment(node, opts) and t.assertJSXOpeningFragment(node, opts).

Aliases: JSX, Immutable


jsxSpreadAttribute

JavaScript

  1. t.jsxSpreadAttribute(argument);

See also t.isJSXSpreadAttribute(node, opts) and t.assertJSXSpreadAttribute(node, opts).

AST Node JSXSpreadAttribute shape:

  • argument: Expression (required)

Aliases: JSX


jsxSpreadChild

JavaScript

  1. t.jsxSpreadChild(expression);

See also t.isJSXSpreadChild(node, opts) and t.assertJSXSpreadChild(node, opts).

AST Node JSXSpreadChild shape:

  • expression: Expression (required)

Aliases: JSX, Immutable


jsxText

JavaScript

  1. t.jsxText(value);

See also t.isJSXText(node, opts) and t.assertJSXText(node, opts).

AST Node JSXText shape:

  • value: string (required)

Aliases: JSX, Immutable


labeledStatement

JavaScript

  1. t.labeledStatement(label, body);

See also t.isLabeledStatement(node, opts) and t.assertLabeledStatement(node, opts).

AST Node LabeledStatement shape:

  • label: Identifier (required)
  • body: Statement (required)

Aliases: Standardized, Statement


logicalExpression

JavaScript

  1. t.logicalExpression(operator, left, right);

See also t.isLogicalExpression(node, opts) and t.assertLogicalExpression(node, opts).

AST Node LogicalExpression shape:

  • operator: "||" | "&&" | "??" (required)
  • left: Expression (required)
  • right: Expression (required)

Aliases: Standardized, Binary, Expression


memberExpression

JavaScript

  1. t.memberExpression(object, property, computed, optional);

See also t.isMemberExpression(node, opts) and t.assertMemberExpression(node, opts).

AST Node MemberExpression shape:

  • object: Expression | Super (required)
  • property: if computed then Expression else Identifier (required)
  • computed: boolean (default: false)
  • optional: boolean (default: null)

Aliases: Standardized, Expression, LVal


metaProperty

JavaScript

  1. t.metaProperty(meta, property);

See also t.isMetaProperty(node, opts) and t.assertMetaProperty(node, opts).

AST Node MetaProperty shape:

  • meta: Identifier (required)
  • property: Identifier (required)

Aliases: Standardized, Expression


mixedTypeAnnotation

JavaScript

  1. t.mixedTypeAnnotation();

See also t.isMixedTypeAnnotation(node, opts) and t.assertMixedTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


moduleExpression

JavaScript

  1. t.moduleExpression(body);

See also t.isModuleExpression(node, opts) and t.assertModuleExpression(node, opts).

AST Node ModuleExpression shape:

  • body: Program (required)

Aliases: Expression


newExpression

JavaScript

  1. t.newExpression(callee, arguments);

See also t.isNewExpression(node, opts) and t.assertNewExpression(node, opts).

AST Node NewExpression shape:

  • callee: Expression | Super | V8IntrinsicIdentifier (required)
  • arguments: Array<Expression | SpreadElement | ArgumentPlaceholder> (required)
  • optional: boolean (default: null, excluded from builder function)
  • typeArguments: TypeParameterInstantiation (default: null, excluded from builder function)
  • typeParameters: TSTypeParameterInstantiation (default: null, excluded from builder function)

Aliases: Standardized, Expression


noop

JavaScript

  1. t.noop();

See also t.isNoop(node, opts) and t.assertNoop(node, opts).

Aliases: Miscellaneous


nullLiteral

JavaScript

  1. t.nullLiteral();

See also t.isNullLiteral(node, opts) and t.assertNullLiteral(node, opts).

Aliases: Standardized, Expression, Pureish, Literal, Immutable


nullLiteralTypeAnnotation

JavaScript

  1. t.nullLiteralTypeAnnotation();

See also t.isNullLiteralTypeAnnotation(node, opts) and t.assertNullLiteralTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


nullableTypeAnnotation

JavaScript

  1. t.nullableTypeAnnotation(typeAnnotation);

See also t.isNullableTypeAnnotation(node, opts) and t.assertNullableTypeAnnotation(node, opts).

AST Node NullableTypeAnnotation shape:

  • typeAnnotation: FlowType (required)

Aliases: Flow, FlowType


numberLiteralTypeAnnotation

JavaScript

  1. t.numberLiteralTypeAnnotation(value);

See also t.isNumberLiteralTypeAnnotation(node, opts) and t.assertNumberLiteralTypeAnnotation(node, opts).

AST Node NumberLiteralTypeAnnotation shape:

  • value: number (required)

Aliases: Flow, FlowType


numberTypeAnnotation

JavaScript

  1. t.numberTypeAnnotation();

See also t.isNumberTypeAnnotation(node, opts) and t.assertNumberTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


numericLiteral

JavaScript

  1. t.numericLiteral(value);

See also t.isNumericLiteral(node, opts) and t.assertNumericLiteral(node, opts).

AST Node NumericLiteral shape:

  • value: a non-negative finite number (required)

Aliases: Standardized, Expression, Pureish, Literal, Immutable


objectExpression

JavaScript

  1. t.objectExpression(properties);

See also t.isObjectExpression(node, opts) and t.assertObjectExpression(node, opts).

AST Node ObjectExpression shape:

  • properties: Array<ObjectMethod | ObjectProperty | SpreadElement> (required)

Aliases: Standardized, Expression


objectMethod

JavaScript

  1. t.objectMethod(kind, key, params, body, computed, generator, async);

See also t.isObjectMethod(node, opts) and t.assertObjectMethod(node, opts).

AST Node ObjectMethod shape:

  • kind: "method" | "get" | "set" (default: 'method')
  • key: if computed then Expression else Identifier | Literal (required)
  • params: Array<Identifier | Pattern | RestElement> (required)
  • body: BlockStatement (required)
  • computed: boolean (default: false)
  • generator: boolean (default: false)
  • async: boolean (default: false)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

Aliases: Standardized, UserWhitespacable, Function, Scopable, BlockParent, FunctionParent, Method, ObjectMember


objectPattern

JavaScript

  1. t.objectPattern(properties);

See also t.isObjectPattern(node, opts) and t.assertObjectPattern(node, opts).

AST Node ObjectPattern shape:

  • properties: Array<RestElement | ObjectProperty> (required)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

Aliases: Standardized, Pattern, PatternLike, LVal


objectProperty

JavaScript

  1. t.objectProperty(key, value, computed, shorthand, decorators);

See also t.isObjectProperty(node, opts) and t.assertObjectProperty(node, opts).

AST Node ObjectProperty shape:

  • key: if computed then Expression else Identifier | Literal (required)
  • value: Expression | PatternLike (required)
  • computed: boolean (default: false)
  • shorthand: boolean (default: false)
  • decorators: Array<Decorator> (default: null)

Aliases: Standardized, UserWhitespacable, Property, ObjectMember


objectTypeAnnotation

JavaScript

  1. t.objectTypeAnnotation(properties, indexers, callProperties, internalSlots, exact);

See also t.isObjectTypeAnnotation(node, opts) and t.assertObjectTypeAnnotation(node, opts).

AST Node ObjectTypeAnnotation shape:

  • properties: Array<ObjectTypeProperty | ObjectTypeSpreadProperty> (required)
  • indexers: Array<ObjectTypeIndexer> (default: [])
  • callProperties: Array<ObjectTypeCallProperty> (default: [])
  • internalSlots: Array<ObjectTypeInternalSlot> (default: [])
  • exact: boolean (default: false)
  • inexact: boolean (default: null, excluded from builder function)

Aliases: Flow, FlowType


objectTypeCallProperty

JavaScript

  1. t.objectTypeCallProperty(value);

See also t.isObjectTypeCallProperty(node, opts) and t.assertObjectTypeCallProperty(node, opts).

AST Node ObjectTypeCallProperty shape:

  • value: FlowType (required)
  • static: boolean (required)

Aliases: Flow, UserWhitespacable


objectTypeIndexer

JavaScript

  1. t.objectTypeIndexer(id, key, value, variance);

See also t.isObjectTypeIndexer(node, opts) and t.assertObjectTypeIndexer(node, opts).

AST Node ObjectTypeIndexer shape:

  • id: Identifier (default: null)
  • key: FlowType (required)
  • value: FlowType (required)
  • variance: Variance (default: null)
  • static: boolean (required)

Aliases: Flow, UserWhitespacable


objectTypeInternalSlot

JavaScript

  1. t.objectTypeInternalSlot(id, value, optional, static, method);

See also t.isObjectTypeInternalSlot(node, opts) and t.assertObjectTypeInternalSlot(node, opts).

AST Node ObjectTypeInternalSlot shape:

  • id: Identifier (required)
  • value: FlowType (required)
  • optional: boolean (required)
  • static: boolean (required)
  • method: boolean (required)

Aliases: Flow, UserWhitespacable


objectTypeProperty

JavaScript

  1. t.objectTypeProperty(key, value, variance);

See also t.isObjectTypeProperty(node, opts) and t.assertObjectTypeProperty(node, opts).

AST Node ObjectTypeProperty shape:

  • key: Identifier | StringLiteral (required)
  • value: FlowType (required)
  • variance: Variance (default: null)
  • kind: "init" | "get" | "set" (required)
  • method: boolean (required)
  • optional: boolean (required)
  • proto: boolean (required)
  • static: boolean (required)

Aliases: Flow, UserWhitespacable


objectTypeSpreadProperty

JavaScript

  1. t.objectTypeSpreadProperty(argument);

See also t.isObjectTypeSpreadProperty(node, opts) and t.assertObjectTypeSpreadProperty(node, opts).

AST Node ObjectTypeSpreadProperty shape:

  • argument: FlowType (required)

Aliases: Flow, UserWhitespacable


opaqueType

JavaScript

  1. t.opaqueType(id, typeParameters, supertype, impltype);

See also t.isOpaqueType(node, opts) and t.assertOpaqueType(node, opts).

AST Node OpaqueType shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterDeclaration (default: null)
  • supertype: FlowType (default: null)
  • impltype: FlowType (required)

Aliases: Flow, FlowDeclaration, Statement, Declaration


optionalCallExpression

JavaScript

  1. t.optionalCallExpression(callee, arguments, optional);

See also t.isOptionalCallExpression(node, opts) and t.assertOptionalCallExpression(node, opts).

AST Node OptionalCallExpression shape:

  • callee: Expression (required)
  • arguments: Array<Expression | SpreadElement | ArgumentPlaceholder> (required)
  • optional: boolean (required)
  • typeArguments: TypeParameterInstantiation (default: null, excluded from builder function)
  • typeParameters: TSTypeParameterInstantiation (default: null, excluded from builder function)

Aliases: Standardized, Expression


optionalIndexedAccessType

JavaScript

  1. t.optionalIndexedAccessType(objectType, indexType);

See also t.isOptionalIndexedAccessType(node, opts) and t.assertOptionalIndexedAccessType(node, opts).

AST Node OptionalIndexedAccessType shape:

  • objectType: FlowType (required)
  • indexType: FlowType (required)
  • optional: boolean (required)

Aliases: Flow, FlowType


optionalMemberExpression

JavaScript

  1. t.optionalMemberExpression(object, property, computed, optional);

See also t.isOptionalMemberExpression(node, opts) and t.assertOptionalMemberExpression(node, opts).

AST Node OptionalMemberExpression shape:

  • object: Expression (required)
  • property: Expression | Identifier (required)
  • computed: boolean (default: false)
  • optional: boolean (required)

Aliases: Standardized, Expression


parenthesizedExpression

JavaScript

  1. t.parenthesizedExpression(expression);

See also t.isParenthesizedExpression(node, opts) and t.assertParenthesizedExpression(node, opts).

AST Node ParenthesizedExpression shape:

  • expression: Expression (required)

Aliases: Standardized, Expression, ExpressionWrapper


pipelineBareFunction

JavaScript

  1. t.pipelineBareFunction(callee);

See also t.isPipelineBareFunction(node, opts) and t.assertPipelineBareFunction(node, opts).

AST Node PipelineBareFunction shape:

  • callee: Expression (required)

Aliases: Expression


pipelinePrimaryTopicReference

JavaScript

  1. t.pipelinePrimaryTopicReference();

See also t.isPipelinePrimaryTopicReference(node, opts) and t.assertPipelinePrimaryTopicReference(node, opts).

Aliases: Expression


pipelineTopicExpression

JavaScript

  1. t.pipelineTopicExpression(expression);

See also t.isPipelineTopicExpression(node, opts) and t.assertPipelineTopicExpression(node, opts).

AST Node PipelineTopicExpression shape:

  • expression: Expression (required)

Aliases: Expression


placeholder

JavaScript

  1. t.placeholder(expectedNode, name);

See also t.isPlaceholder(node, opts) and t.assertPlaceholder(node, opts).

AST Node Placeholder shape:

  • expectedNode: "Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern" (required)
  • name: Identifier (required)

Aliases: Miscellaneous


privateName

JavaScript

  1. t.privateName(id);

See also t.isPrivateName(node, opts) and t.assertPrivateName(node, opts).

AST Node PrivateName shape:

  • id: Identifier (required)

Aliases: Standardized, Private


program

JavaScript

  1. t.program(body, directives, sourceType, interpreter);

See also t.isProgram(node, opts) and t.assertProgram(node, opts).

AST Node Program shape:

  • body: Array<Statement> (required)
  • directives: Array<Directive> (default: [])
  • sourceType: "script" | "module" (default: 'script')
  • interpreter: InterpreterDirective (default: null)

Aliases: Standardized, Scopable, BlockParent, Block


qualifiedTypeIdentifier

JavaScript

  1. t.qualifiedTypeIdentifier(id, qualification);

See also t.isQualifiedTypeIdentifier(node, opts) and t.assertQualifiedTypeIdentifier(node, opts).

AST Node QualifiedTypeIdentifier shape:

  • id: Identifier (required)
  • qualification: Identifier | QualifiedTypeIdentifier (required)

Aliases: Flow


recordExpression

JavaScript

  1. t.recordExpression(properties);

See also t.isRecordExpression(node, opts) and t.assertRecordExpression(node, opts).

AST Node RecordExpression shape:

  • properties: Array<ObjectProperty | SpreadElement> (required)

Aliases: Expression


regExpLiteral

JavaScript

  1. t.regExpLiteral(pattern, flags);

See also t.isRegExpLiteral(node, opts) and t.assertRegExpLiteral(node, opts).

AST Node RegExpLiteral shape:

  • pattern: string (required)
  • flags: string (default: '')

Aliases: Standardized, Expression, Pureish, Literal


restElement

JavaScript

  1. t.restElement(argument);

See also t.isRestElement(node, opts) and t.assertRestElement(node, opts).

AST Node RestElement shape:

  • argument: LVal (required)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

Aliases: Standardized, LVal, PatternLike


returnStatement

JavaScript

  1. t.returnStatement(argument);

See also t.isReturnStatement(node, opts) and t.assertReturnStatement(node, opts).

AST Node ReturnStatement shape:

  • argument: Expression (default: null)

Aliases: Standardized, Statement, Terminatorless, CompletionStatement


sequenceExpression

JavaScript

  1. t.sequenceExpression(expressions);

See also t.isSequenceExpression(node, opts) and t.assertSequenceExpression(node, opts).

AST Node SequenceExpression shape:

  • expressions: Array<Expression> (required)

Aliases: Standardized, Expression


spreadElement

JavaScript

  1. t.spreadElement(argument);

See also t.isSpreadElement(node, opts) and t.assertSpreadElement(node, opts).

AST Node SpreadElement shape:

  • argument: Expression (required)

Aliases: Standardized, UnaryLike


staticBlock

JavaScript

  1. t.staticBlock(body);

See also t.isStaticBlock(node, opts) and t.assertStaticBlock(node, opts).

AST Node StaticBlock shape:

  • body: Array<Statement> (required)

Aliases: Standardized, Scopable, BlockParent, FunctionParent


stringLiteral

JavaScript

  1. t.stringLiteral(value);

See also t.isStringLiteral(node, opts) and t.assertStringLiteral(node, opts).

AST Node StringLiteral shape:

  • value: string (required)

Aliases: Standardized, Expression, Pureish, Literal, Immutable


stringLiteralTypeAnnotation

JavaScript

  1. t.stringLiteralTypeAnnotation(value);

See also t.isStringLiteralTypeAnnotation(node, opts) and t.assertStringLiteralTypeAnnotation(node, opts).

AST Node StringLiteralTypeAnnotation shape:

  • value: string (required)

Aliases: Flow, FlowType


stringTypeAnnotation

JavaScript

  1. t.stringTypeAnnotation();

See also t.isStringTypeAnnotation(node, opts) and t.assertStringTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


super

JavaScript

  1. t.super();

See also t.isSuper(node, opts) and t.assertSuper(node, opts).

Aliases: Standardized, Expression


switchCase

JavaScript

  1. t.switchCase(test, consequent);

See also t.isSwitchCase(node, opts) and t.assertSwitchCase(node, opts).

AST Node SwitchCase shape:

  • test: Expression (default: null)
  • consequent: Array<Statement> (required)

Aliases: Standardized


switchStatement

JavaScript

  1. t.switchStatement(discriminant, cases);

See also t.isSwitchStatement(node, opts) and t.assertSwitchStatement(node, opts).

AST Node SwitchStatement shape:

  • discriminant: Expression (required)
  • cases: Array<SwitchCase> (required)

Aliases: Standardized, Statement, BlockParent, Scopable


symbolTypeAnnotation

JavaScript

  1. t.symbolTypeAnnotation();

See also t.isSymbolTypeAnnotation(node, opts) and t.assertSymbolTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


tsAnyKeyword

JavaScript

  1. t.tsAnyKeyword();

See also t.isTSAnyKeyword(node, opts) and t.assertTSAnyKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsArrayType

JavaScript

  1. t.tsArrayType(elementType);

See also t.isTSArrayType(node, opts) and t.assertTSArrayType(node, opts).

AST Node TSArrayType shape:

  • elementType: TSType (required)

Aliases: TypeScript, TSType


tsAsExpression

JavaScript

  1. t.tsAsExpression(expression, typeAnnotation);

See also t.isTSAsExpression(node, opts) and t.assertTSAsExpression(node, opts).

AST Node TSAsExpression shape:

  • expression: Expression (required)
  • typeAnnotation: TSType (required)

Aliases: TypeScript, Expression, LVal, PatternLike


tsBigIntKeyword

JavaScript

  1. t.tsBigIntKeyword();

See also t.isTSBigIntKeyword(node, opts) and t.assertTSBigIntKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsBooleanKeyword

JavaScript

  1. t.tsBooleanKeyword();

See also t.isTSBooleanKeyword(node, opts) and t.assertTSBooleanKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsCallSignatureDeclaration

JavaScript

  1. t.tsCallSignatureDeclaration(typeParameters, parameters, typeAnnotation);

See also t.isTSCallSignatureDeclaration(node, opts) and t.assertTSCallSignatureDeclaration(node, opts).

AST Node TSCallSignatureDeclaration shape:

  • typeParameters: TSTypeParameterDeclaration (default: null)
  • parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)
  • typeAnnotation: TSTypeAnnotation (default: null)

Aliases: TypeScript, TSTypeElement


tsConditionalType

JavaScript

  1. t.tsConditionalType(checkType, extendsType, trueType, falseType);

See also t.isTSConditionalType(node, opts) and t.assertTSConditionalType(node, opts).

AST Node TSConditionalType shape:

  • checkType: TSType (required)
  • extendsType: TSType (required)
  • trueType: TSType (required)
  • falseType: TSType (required)

Aliases: TypeScript, TSType


tsConstructSignatureDeclaration

JavaScript

  1. t.tsConstructSignatureDeclaration(typeParameters, parameters, typeAnnotation);

See also t.isTSConstructSignatureDeclaration(node, opts) and t.assertTSConstructSignatureDeclaration(node, opts).

AST Node TSConstructSignatureDeclaration shape:

  • typeParameters: TSTypeParameterDeclaration (default: null)
  • parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)
  • typeAnnotation: TSTypeAnnotation (default: null)

Aliases: TypeScript, TSTypeElement


tsConstructorType

JavaScript

  1. t.tsConstructorType(typeParameters, parameters, typeAnnotation);

See also t.isTSConstructorType(node, opts) and t.assertTSConstructorType(node, opts).

AST Node TSConstructorType shape:

  • typeParameters: TSTypeParameterDeclaration (default: null)
  • parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)
  • typeAnnotation: TSTypeAnnotation (default: null)
  • abstract: boolean (default: null, excluded from builder function)

Aliases: TypeScript, TSType


tsDeclareFunction

JavaScript

  1. t.tsDeclareFunction(id, typeParameters, params, returnType);

See also t.isTSDeclareFunction(node, opts) and t.assertTSDeclareFunction(node, opts).

AST Node TSDeclareFunction shape:

  • id: Identifier (default: null)
  • typeParameters: TSTypeParameterDeclaration | Noop (default: null)
  • params: Array<Identifier | Pattern | RestElement> (required)
  • returnType: TSTypeAnnotation | Noop (default: null)
  • async: boolean (default: false, excluded from builder function)
  • declare: boolean (default: null, excluded from builder function)
  • generator: boolean (default: false, excluded from builder function)

Aliases: TypeScript, Statement, Declaration


tsDeclareMethod

JavaScript

  1. t.tsDeclareMethod(decorators, key, typeParameters, params, returnType);

See also t.isTSDeclareMethod(node, opts) and t.assertTSDeclareMethod(node, opts).

AST Node TSDeclareMethod shape:

  • decorators: Array<Decorator> (default: null)
  • key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression (required)
  • typeParameters: TSTypeParameterDeclaration | Noop (default: null)
  • params: Array<Identifier | Pattern | RestElement | TSParameterProperty> (required)
  • returnType: TSTypeAnnotation | Noop (default: null)
  • abstract: boolean (default: null, excluded from builder function)
  • access: "public" | "private" | "protected" (default: null, excluded from builder function)
  • accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)
  • async: boolean (default: false, excluded from builder function)
  • computed: boolean (default: false, excluded from builder function)
  • generator: boolean (default: false, excluded from builder function)
  • kind: "get" | "set" | "method" | "constructor" (default: 'method', excluded from builder function)
  • optional: boolean (default: null, excluded from builder function)
  • override: boolean (default: false, excluded from builder function)
  • static: boolean (default: false, excluded from builder function)

Aliases: TypeScript


tsEnumDeclaration

JavaScript

  1. t.tsEnumDeclaration(id, members);

See also t.isTSEnumDeclaration(node, opts) and t.assertTSEnumDeclaration(node, opts).

AST Node TSEnumDeclaration shape:

  • id: Identifier (required)
  • members: Array<TSEnumMember> (required)
  • const: boolean (default: null, excluded from builder function)
  • declare: boolean (default: null, excluded from builder function)
  • initializer: Expression (default: null, excluded from builder function)

Aliases: TypeScript, Statement, Declaration


tsEnumMember

JavaScript

  1. t.tsEnumMember(id, initializer);

See also t.isTSEnumMember(node, opts) and t.assertTSEnumMember(node, opts).

AST Node TSEnumMember shape:

  • id: Identifier | StringLiteral (required)
  • initializer: Expression (default: null)

Aliases: TypeScript


tsExportAssignment

JavaScript

  1. t.tsExportAssignment(expression);

See also t.isTSExportAssignment(node, opts) and t.assertTSExportAssignment(node, opts).

AST Node TSExportAssignment shape:

  • expression: Expression (required)

Aliases: TypeScript, Statement


tsExpressionWithTypeArguments

JavaScript

  1. t.tsExpressionWithTypeArguments(expression, typeParameters);

See also t.isTSExpressionWithTypeArguments(node, opts) and t.assertTSExpressionWithTypeArguments(node, opts).

AST Node TSExpressionWithTypeArguments shape:

  • expression: TSEntityName (required)
  • typeParameters: TSTypeParameterInstantiation (default: null)

Aliases: TypeScript, TSType


tsExternalModuleReference

JavaScript

  1. t.tsExternalModuleReference(expression);

See also t.isTSExternalModuleReference(node, opts) and t.assertTSExternalModuleReference(node, opts).

AST Node TSExternalModuleReference shape:

  • expression: StringLiteral (required)

Aliases: TypeScript


tsFunctionType

JavaScript

  1. t.tsFunctionType(typeParameters, parameters, typeAnnotation);

See also t.isTSFunctionType(node, opts) and t.assertTSFunctionType(node, opts).

AST Node TSFunctionType shape:

  • typeParameters: TSTypeParameterDeclaration (default: null)
  • parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)
  • typeAnnotation: TSTypeAnnotation (default: null)

Aliases: TypeScript, TSType


tsImportEqualsDeclaration

JavaScript

  1. t.tsImportEqualsDeclaration(id, moduleReference);

See also t.isTSImportEqualsDeclaration(node, opts) and t.assertTSImportEqualsDeclaration(node, opts).

AST Node TSImportEqualsDeclaration shape:

  • id: Identifier (required)
  • moduleReference: TSEntityName | TSExternalModuleReference (required)
  • importKind: "type" | "value" (default: null, excluded from builder function)
  • isExport: boolean (required)

Aliases: TypeScript, Statement


tsImportType

JavaScript

  1. t.tsImportType(argument, qualifier, typeParameters);

See also t.isTSImportType(node, opts) and t.assertTSImportType(node, opts).

AST Node TSImportType shape:

  • argument: StringLiteral (required)
  • qualifier: TSEntityName (default: null)
  • typeParameters: TSTypeParameterInstantiation (default: null)
  • options: Expression (default: null, excluded from builder function)

Aliases: TypeScript, TSType


tsIndexSignature

JavaScript

  1. t.tsIndexSignature(parameters, typeAnnotation);

See also t.isTSIndexSignature(node, opts) and t.assertTSIndexSignature(node, opts).

AST Node TSIndexSignature shape:

  • parameters: Array<Identifier> (required)
  • typeAnnotation: TSTypeAnnotation (default: null)
  • readonly: boolean (default: null, excluded from builder function)
  • static: boolean (default: null, excluded from builder function)

Aliases: TypeScript, TSTypeElement


tsIndexedAccessType

JavaScript

  1. t.tsIndexedAccessType(objectType, indexType);

See also t.isTSIndexedAccessType(node, opts) and t.assertTSIndexedAccessType(node, opts).

AST Node TSIndexedAccessType shape:

  • objectType: TSType (required)
  • indexType: TSType (required)

Aliases: TypeScript, TSType


tsInferType

JavaScript

  1. t.tsInferType(typeParameter);

See also t.isTSInferType(node, opts) and t.assertTSInferType(node, opts).

AST Node TSInferType shape:

  • typeParameter: TSTypeParameter (required)

Aliases: TypeScript, TSType


tsInstantiationExpression

JavaScript

  1. t.tsInstantiationExpression(expression, typeParameters);

See also t.isTSInstantiationExpression(node, opts) and t.assertTSInstantiationExpression(node, opts).

AST Node TSInstantiationExpression shape:

  • expression: Expression (required)
  • typeParameters: TSTypeParameterInstantiation (default: null)

Aliases: TypeScript, Expression


tsInterfaceBody

JavaScript

  1. t.tsInterfaceBody(body);

See also t.isTSInterfaceBody(node, opts) and t.assertTSInterfaceBody(node, opts).

AST Node TSInterfaceBody shape:

  • body: Array<TSTypeElement> (required)

Aliases: TypeScript


tsInterfaceDeclaration

JavaScript

  1. t.tsInterfaceDeclaration(id, typeParameters, extends, body);

See also t.isTSInterfaceDeclaration(node, opts) and t.assertTSInterfaceDeclaration(node, opts).

AST Node TSInterfaceDeclaration shape:

  • id: Identifier (required)
  • typeParameters: TSTypeParameterDeclaration (default: null)
  • extends: Array<TSExpressionWithTypeArguments> (default: null)
  • body: TSInterfaceBody (required)
  • declare: boolean (default: null, excluded from builder function)

Aliases: TypeScript, Statement, Declaration


tsIntersectionType

JavaScript

  1. t.tsIntersectionType(types);

See also t.isTSIntersectionType(node, opts) and t.assertTSIntersectionType(node, opts).

AST Node TSIntersectionType shape:

  • types: Array<TSType> (required)

Aliases: TypeScript, TSType


tsIntrinsicKeyword

JavaScript

  1. t.tsIntrinsicKeyword();

See also t.isTSIntrinsicKeyword(node, opts) and t.assertTSIntrinsicKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsLiteralType

JavaScript

  1. t.tsLiteralType(literal);

See also t.isTSLiteralType(node, opts) and t.assertTSLiteralType(node, opts).

AST Node TSLiteralType shape:

  • literal: NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TemplateLiteral | UnaryExpression (required)

Aliases: TypeScript, TSType, TSBaseType


tsMappedType

JavaScript

  1. t.tsMappedType(typeParameter, typeAnnotation, nameType);

See also t.isTSMappedType(node, opts) and t.assertTSMappedType(node, opts).

AST Node TSMappedType shape:

  • typeParameter: TSTypeParameter (required)
  • typeAnnotation: TSType (default: null)
  • nameType: TSType (default: null)
  • optional: true | false | "+" | "-" (default: null, excluded from builder function)
  • readonly: true | false | "+" | "-" (default: null, excluded from builder function)

Aliases: TypeScript, TSType


tsMethodSignature

JavaScript

  1. t.tsMethodSignature(key, typeParameters, parameters, typeAnnotation);

See also t.isTSMethodSignature(node, opts) and t.assertTSMethodSignature(node, opts).

AST Node TSMethodSignature shape:

  • key: Expression (required)
  • typeParameters: TSTypeParameterDeclaration (default: null)
  • parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)
  • typeAnnotation: TSTypeAnnotation (default: null)
  • computed: boolean (default: false, excluded from builder function)
  • kind: "method" | "get" | "set" (required)
  • optional: boolean (default: null, excluded from builder function)

Aliases: TypeScript, TSTypeElement


tsModuleBlock

JavaScript

  1. t.tsModuleBlock(body);

See also t.isTSModuleBlock(node, opts) and t.assertTSModuleBlock(node, opts).

AST Node TSModuleBlock shape:

  • body: Array<Statement> (required)

Aliases: TypeScript, Scopable, Block, BlockParent, FunctionParent


tsModuleDeclaration

JavaScript

  1. t.tsModuleDeclaration(id, body);

See also t.isTSModuleDeclaration(node, opts) and t.assertTSModuleDeclaration(node, opts).

AST Node TSModuleDeclaration shape:

  • id: Identifier | StringLiteral (required)
  • body: TSModuleBlock | TSModuleDeclaration (required)
  • declare: boolean (default: null, excluded from builder function)
  • global: boolean (default: null, excluded from builder function)

Aliases: TypeScript, Statement, Declaration


tsNamedTupleMember

JavaScript

  1. t.tsNamedTupleMember(label, elementType, optional);

See also t.isTSNamedTupleMember(node, opts) and t.assertTSNamedTupleMember(node, opts).

AST Node TSNamedTupleMember shape:

  • label: Identifier (required)
  • elementType: TSType (required)
  • optional: boolean (default: false)

Aliases: TypeScript


tsNamespaceExportDeclaration

JavaScript

  1. t.tsNamespaceExportDeclaration(id);

See also t.isTSNamespaceExportDeclaration(node, opts) and t.assertTSNamespaceExportDeclaration(node, opts).

AST Node TSNamespaceExportDeclaration shape:

  • id: Identifier (required)

Aliases: TypeScript, Statement


tsNeverKeyword

JavaScript

  1. t.tsNeverKeyword();

See also t.isTSNeverKeyword(node, opts) and t.assertTSNeverKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsNonNullExpression

JavaScript

  1. t.tsNonNullExpression(expression);

See also t.isTSNonNullExpression(node, opts) and t.assertTSNonNullExpression(node, opts).

AST Node TSNonNullExpression shape:

  • expression: Expression (required)

Aliases: TypeScript, Expression, LVal, PatternLike


tsNullKeyword

JavaScript

  1. t.tsNullKeyword();

See also t.isTSNullKeyword(node, opts) and t.assertTSNullKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsNumberKeyword

JavaScript

  1. t.tsNumberKeyword();

See also t.isTSNumberKeyword(node, opts) and t.assertTSNumberKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsObjectKeyword

JavaScript

  1. t.tsObjectKeyword();

See also t.isTSObjectKeyword(node, opts) and t.assertTSObjectKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsOptionalType

JavaScript

  1. t.tsOptionalType(typeAnnotation);

See also t.isTSOptionalType(node, opts) and t.assertTSOptionalType(node, opts).

AST Node TSOptionalType shape:

  • typeAnnotation: TSType (required)

Aliases: TypeScript, TSType


tsParameterProperty

JavaScript

  1. t.tsParameterProperty(parameter);

See also t.isTSParameterProperty(node, opts) and t.assertTSParameterProperty(node, opts).

AST Node TSParameterProperty shape:

  • parameter: Identifier | AssignmentPattern (required)
  • accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)
  • decorators: Array<Decorator> (default: null, excluded from builder function)
  • override: boolean (default: null, excluded from builder function)
  • readonly: boolean (default: null, excluded from builder function)

Aliases: TypeScript, LVal


tsParenthesizedType

JavaScript

  1. t.tsParenthesizedType(typeAnnotation);

See also t.isTSParenthesizedType(node, opts) and t.assertTSParenthesizedType(node, opts).

AST Node TSParenthesizedType shape:

  • typeAnnotation: TSType (required)

Aliases: TypeScript, TSType


tsPropertySignature

JavaScript

  1. t.tsPropertySignature(key, typeAnnotation);

See also t.isTSPropertySignature(node, opts) and t.assertTSPropertySignature(node, opts).

AST Node TSPropertySignature shape:

  • key: Expression (required)
  • typeAnnotation: TSTypeAnnotation (default: null)
  • computed: boolean (default: false, excluded from builder function)
  • kind: "get" | "set" (required)
  • optional: boolean (default: null, excluded from builder function)
  • readonly: boolean (default: null, excluded from builder function)

Aliases: TypeScript, TSTypeElement


tsQualifiedName

JavaScript

  1. t.tsQualifiedName(left, right);

See also t.isTSQualifiedName(node, opts) and t.assertTSQualifiedName(node, opts).

AST Node TSQualifiedName shape:

  • left: TSEntityName (required)
  • right: Identifier (required)

Aliases: TypeScript, TSEntityName


tsRestType

JavaScript

  1. t.tsRestType(typeAnnotation);

See also t.isTSRestType(node, opts) and t.assertTSRestType(node, opts).

AST Node TSRestType shape:

  • typeAnnotation: TSType (required)

Aliases: TypeScript, TSType


tsSatisfiesExpression

JavaScript

  1. t.tsSatisfiesExpression(expression, typeAnnotation);

History

VersionChanges
v7.20.0Introduced

See also t.isTSSatisfiesExpression(node, opts) and t.assertTSSatisfiesExpression(node, opts).

AST Node TSSatisfiesExpression shape:

  • expression: Expression (required)
  • typeAnnotation: TSType (required)

Aliases: TypeScript, Expression, LVal, PatternLike


tsStringKeyword

JavaScript

  1. t.tsStringKeyword();

See also t.isTSStringKeyword(node, opts) and t.assertTSStringKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsSymbolKeyword

JavaScript

  1. t.tsSymbolKeyword();

See also t.isTSSymbolKeyword(node, opts) and t.assertTSSymbolKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsThisType

JavaScript

  1. t.tsThisType();

See also t.isTSThisType(node, opts) and t.assertTSThisType(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsTupleType

JavaScript

  1. t.tsTupleType(elementTypes);

See also t.isTSTupleType(node, opts) and t.assertTSTupleType(node, opts).

AST Node TSTupleType shape:

  • elementTypes: Array<TSType | TSNamedTupleMember> (required)

Aliases: TypeScript, TSType


tsTypeAliasDeclaration

JavaScript

  1. t.tsTypeAliasDeclaration(id, typeParameters, typeAnnotation);

See also t.isTSTypeAliasDeclaration(node, opts) and t.assertTSTypeAliasDeclaration(node, opts).

AST Node TSTypeAliasDeclaration shape:

  • id: Identifier (required)
  • typeParameters: TSTypeParameterDeclaration (default: null)
  • typeAnnotation: TSType (required)
  • declare: boolean (default: null, excluded from builder function)

Aliases: TypeScript, Statement, Declaration


tsTypeAnnotation

JavaScript

  1. t.tsTypeAnnotation(typeAnnotation);

See also t.isTSTypeAnnotation(node, opts) and t.assertTSTypeAnnotation(node, opts).

AST Node TSTypeAnnotation shape:

  • typeAnnotation: TSType (required)

Aliases: TypeScript


tsTypeAssertion

JavaScript

  1. t.tsTypeAssertion(typeAnnotation, expression);

See also t.isTSTypeAssertion(node, opts) and t.assertTSTypeAssertion(node, opts).

AST Node TSTypeAssertion shape:

  • typeAnnotation: TSType (required)
  • expression: Expression (required)

Aliases: TypeScript, Expression, LVal, PatternLike


tsTypeLiteral

JavaScript

  1. t.tsTypeLiteral(members);

See also t.isTSTypeLiteral(node, opts) and t.assertTSTypeLiteral(node, opts).

AST Node TSTypeLiteral shape:

  • members: Array<TSTypeElement> (required)

Aliases: TypeScript, TSType


tsTypeOperator

JavaScript

  1. t.tsTypeOperator(typeAnnotation);

See also t.isTSTypeOperator(node, opts) and t.assertTSTypeOperator(node, opts).

AST Node TSTypeOperator shape:

  • typeAnnotation: TSType (required)
  • operator: string (required)

Aliases: TypeScript, TSType


tsTypeParameter

JavaScript

  1. t.tsTypeParameter(constraint, default, name);

History

VersionChanges
v7.21.0Supports const

See also t.isTSTypeParameter(node, opts) and t.assertTSTypeParameter(node, opts).

AST Node TSTypeParameter shape:

  • constraint: TSType (default: null)
  • default: TSType (default: null)
  • name: string (required)
  • const: boolean (default: null, excluded from builder function)
  • in: boolean (default: null, excluded from builder function)
  • out: boolean (default: null, excluded from builder function)

Aliases: TypeScript


tsTypeParameterDeclaration

JavaScript

  1. t.tsTypeParameterDeclaration(params);

See also t.isTSTypeParameterDeclaration(node, opts) and t.assertTSTypeParameterDeclaration(node, opts).

AST Node TSTypeParameterDeclaration shape:

  • params: Array<TSTypeParameter> (required)

Aliases: TypeScript


tsTypeParameterInstantiation

JavaScript

  1. t.tsTypeParameterInstantiation(params);

See also t.isTSTypeParameterInstantiation(node, opts) and t.assertTSTypeParameterInstantiation(node, opts).

AST Node TSTypeParameterInstantiation shape:

  • params: Array<TSType> (required)

Aliases: TypeScript


tsTypePredicate

JavaScript

  1. t.tsTypePredicate(parameterName, typeAnnotation, asserts);

See also t.isTSTypePredicate(node, opts) and t.assertTSTypePredicate(node, opts).

AST Node TSTypePredicate shape:

  • parameterName: Identifier | TSThisType (required)
  • typeAnnotation: TSTypeAnnotation (default: null)
  • asserts: boolean (default: null)

Aliases: TypeScript, TSType


tsTypeQuery

JavaScript

  1. t.tsTypeQuery(exprName, typeParameters);

See also t.isTSTypeQuery(node, opts) and t.assertTSTypeQuery(node, opts).

AST Node TSTypeQuery shape:

  • exprName: TSEntityName | TSImportType (required)
  • typeParameters: TSTypeParameterInstantiation (default: null)

Aliases: TypeScript, TSType


tsTypeReference

JavaScript

  1. t.tsTypeReference(typeName, typeParameters);

See also t.isTSTypeReference(node, opts) and t.assertTSTypeReference(node, opts).

AST Node TSTypeReference shape:

  • typeName: TSEntityName (required)
  • typeParameters: TSTypeParameterInstantiation (default: null)

Aliases: TypeScript, TSType


tsUndefinedKeyword

JavaScript

  1. t.tsUndefinedKeyword();

See also t.isTSUndefinedKeyword(node, opts) and t.assertTSUndefinedKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsUnionType

JavaScript

  1. t.tsUnionType(types);

See also t.isTSUnionType(node, opts) and t.assertTSUnionType(node, opts).

AST Node TSUnionType shape:

  • types: Array<TSType> (required)

Aliases: TypeScript, TSType


tsUnknownKeyword

JavaScript

  1. t.tsUnknownKeyword();

See also t.isTSUnknownKeyword(node, opts) and t.assertTSUnknownKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


tsVoidKeyword

JavaScript

  1. t.tsVoidKeyword();

See also t.isTSVoidKeyword(node, opts) and t.assertTSVoidKeyword(node, opts).

Aliases: TypeScript, TSType, TSBaseType


taggedTemplateExpression

JavaScript

  1. t.taggedTemplateExpression(tag, quasi);

See also t.isTaggedTemplateExpression(node, opts) and t.assertTaggedTemplateExpression(node, opts).

AST Node TaggedTemplateExpression shape:

  • tag: Expression (required)
  • quasi: TemplateLiteral (required)
  • typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)

Aliases: Standardized, Expression


templateElement

JavaScript

  1. t.templateElement(value, tail);

See also t.isTemplateElement(node, opts) and t.assertTemplateElement(node, opts).

AST Node TemplateElement shape:

  • value: { raw: string, cooked?: string } (required)
  • tail: boolean (default: false)

Aliases: Standardized


templateLiteral

JavaScript

  1. t.templateLiteral(quasis, expressions);

See also t.isTemplateLiteral(node, opts) and t.assertTemplateLiteral(node, opts).

AST Node TemplateLiteral shape:

  • quasis: Array<TemplateElement> (required)
  • expressions: Array<Expression | TSType> (required)

Aliases: Standardized, Expression, Literal


thisExpression

JavaScript

  1. t.thisExpression();

See also t.isThisExpression(node, opts) and t.assertThisExpression(node, opts).

Aliases: Standardized, Expression


thisTypeAnnotation

JavaScript

  1. t.thisTypeAnnotation();

See also t.isThisTypeAnnotation(node, opts) and t.assertThisTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


throwStatement

JavaScript

  1. t.throwStatement(argument);

See also t.isThrowStatement(node, opts) and t.assertThrowStatement(node, opts).

AST Node ThrowStatement shape:

  • argument: Expression (required)

Aliases: Standardized, Statement, Terminatorless, CompletionStatement


topicReference

JavaScript

  1. t.topicReference();

See also t.isTopicReference(node, opts) and t.assertTopicReference(node, opts).

Aliases: Expression


tryStatement

JavaScript

  1. t.tryStatement(block, handler, finalizer);

See also t.isTryStatement(node, opts) and t.assertTryStatement(node, opts).

AST Node TryStatement shape:

  • block: BlockStatement (required)
  • handler: CatchClause (default: null)
  • finalizer: BlockStatement (default: null)

Aliases: Standardized, Statement


tupleExpression

JavaScript

  1. t.tupleExpression(elements);

See also t.isTupleExpression(node, opts) and t.assertTupleExpression(node, opts).

AST Node TupleExpression shape:

  • elements: Array<Expression | SpreadElement> (default: [])

Aliases: Expression


tupleTypeAnnotation

JavaScript

  1. t.tupleTypeAnnotation(types);

See also t.isTupleTypeAnnotation(node, opts) and t.assertTupleTypeAnnotation(node, opts).

AST Node TupleTypeAnnotation shape:

  • types: Array<FlowType> (required)

Aliases: Flow, FlowType


typeAlias

JavaScript

  1. t.typeAlias(id, typeParameters, right);

See also t.isTypeAlias(node, opts) and t.assertTypeAlias(node, opts).

AST Node TypeAlias shape:

  • id: Identifier (required)
  • typeParameters: TypeParameterDeclaration (default: null)
  • right: FlowType (required)

Aliases: Flow, FlowDeclaration, Statement, Declaration


typeAnnotation

JavaScript

  1. t.typeAnnotation(typeAnnotation);

See also t.isTypeAnnotation(node, opts) and t.assertTypeAnnotation(node, opts).

AST Node TypeAnnotation shape:

  • typeAnnotation: FlowType (required)

Aliases: Flow


typeCastExpression

JavaScript

  1. t.typeCastExpression(expression, typeAnnotation);

See also t.isTypeCastExpression(node, opts) and t.assertTypeCastExpression(node, opts).

AST Node TypeCastExpression shape:

  • expression: Expression (required)
  • typeAnnotation: TypeAnnotation (required)

Aliases: Flow, ExpressionWrapper, Expression


typeParameter

JavaScript

  1. t.typeParameter(bound, default, variance);

See also t.isTypeParameter(node, opts) and t.assertTypeParameter(node, opts).

AST Node TypeParameter shape:

  • bound: TypeAnnotation (default: null)
  • default: FlowType (default: null)
  • variance: Variance (default: null)
  • name: string (required)

Aliases: Flow


typeParameterDeclaration

JavaScript

  1. t.typeParameterDeclaration(params);

See also t.isTypeParameterDeclaration(node, opts) and t.assertTypeParameterDeclaration(node, opts).

AST Node TypeParameterDeclaration shape:

  • params: Array<TypeParameter> (required)

Aliases: Flow


typeParameterInstantiation

JavaScript

  1. t.typeParameterInstantiation(params);

See also t.isTypeParameterInstantiation(node, opts) and t.assertTypeParameterInstantiation(node, opts).

AST Node TypeParameterInstantiation shape:

  • params: Array<FlowType> (required)

Aliases: Flow


typeofTypeAnnotation

JavaScript

  1. t.typeofTypeAnnotation(argument);

See also t.isTypeofTypeAnnotation(node, opts) and t.assertTypeofTypeAnnotation(node, opts).

AST Node TypeofTypeAnnotation shape:

  • argument: FlowType (required)

Aliases: Flow, FlowType


unaryExpression

JavaScript

  1. t.unaryExpression(operator, argument, prefix);

See also t.isUnaryExpression(node, opts) and t.assertUnaryExpression(node, opts).

AST Node UnaryExpression shape:

  • operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof" (required)
  • argument: Expression (required)
  • prefix: boolean (default: true)

Aliases: Standardized, UnaryLike, Expression


unionTypeAnnotation

JavaScript

  1. t.unionTypeAnnotation(types);

See also t.isUnionTypeAnnotation(node, opts) and t.assertUnionTypeAnnotation(node, opts).

AST Node UnionTypeAnnotation shape:

  • types: Array<FlowType> (required)

Aliases: Flow, FlowType


updateExpression

JavaScript

  1. t.updateExpression(operator, argument, prefix);

See also t.isUpdateExpression(node, opts) and t.assertUpdateExpression(node, opts).

AST Node UpdateExpression shape:

  • operator: "++" | "--" (required)
  • argument: Expression (required)
  • prefix: boolean (default: false)

Aliases: Standardized, Expression


v8IntrinsicIdentifier

JavaScript

  1. t.v8IntrinsicIdentifier(name);

See also t.isV8IntrinsicIdentifier(node, opts) and t.assertV8IntrinsicIdentifier(node, opts).

AST Node V8IntrinsicIdentifier shape:

  • name: string (required)

Aliases: Miscellaneous


variableDeclaration

JavaScript

  1. t.variableDeclaration(kind, declarations);

History

VersionChanges
v7.20.0kind can be “using”.

See also t.isVariableDeclaration(node, opts) and t.assertVariableDeclaration(node, opts).

AST Node VariableDeclaration shape:

  • kind: "var" | "let" | "const" | "using" | "await using" (required)
  • declarations: Array<VariableDeclarator> (required)
  • declare: boolean (default: null, excluded from builder function)

Aliases: Standardized, Statement, Declaration


variableDeclarator

JavaScript

  1. t.variableDeclarator(id, init);

See also t.isVariableDeclarator(node, opts) and t.assertVariableDeclarator(node, opts).

AST Node VariableDeclarator shape:

  • id: LVal (required)
  • init: Expression (default: null)
  • definite: boolean (default: null, excluded from builder function)

Aliases: Standardized


variance

JavaScript

  1. t.variance(kind);

See also t.isVariance(node, opts) and t.assertVariance(node, opts).

AST Node Variance shape:

  • kind: "minus" | "plus" (required)

Aliases: Flow


voidTypeAnnotation

JavaScript

  1. t.voidTypeAnnotation();

See also t.isVoidTypeAnnotation(node, opts) and t.assertVoidTypeAnnotation(node, opts).

Aliases: Flow, FlowType, FlowBaseAnnotation


whileStatement

JavaScript

  1. t.whileStatement(test, body);

See also t.isWhileStatement(node, opts) and t.assertWhileStatement(node, opts).

AST Node WhileStatement shape:

  • test: Expression (required)
  • body: Statement (required)

Aliases: Standardized, Statement, BlockParent, Loop, While, Scopable


withStatement

JavaScript

  1. t.withStatement(object, body);

See also t.isWithStatement(node, opts) and t.assertWithStatement(node, opts).

AST Node WithStatement shape:

  • object: Expression (required)
  • body: Statement (required)

Aliases: Standardized, Statement


yieldExpression

JavaScript

  1. t.yieldExpression(argument, delegate);

See also t.isYieldExpression(node, opts) and t.assertYieldExpression(node, opts).

AST Node YieldExpression shape:

  • argument: Expression (default: null)
  • delegate: boolean (default: false)

Aliases: Standardized, Expression, Terminatorless


Aliases

Accessor

Deprecated. Will be removed in Babel 8.

JavaScript

  1. t.isAccessor(node);

Covered nodes:

Binary

A cover of BinaryExpression and LogicalExpression, which share the same AST shape.

JavaScript

  1. t.isBinary(node);

Covered nodes:

Block

Deprecated. Will be removed in Babel 8.

JavaScript

  1. t.isBlock(node);

Covered nodes:

BlockParent

A cover of AST nodes that start an execution context with new LexicalEnvironment. In other words, they define the scope of let and const declarations.

JavaScript

  1. t.isBlockParent(node);

Covered nodes:

Class

A cover of ClassExpression and ClassDeclaration, which share the same AST shape.

JavaScript

  1. t.isClass(node);

Covered nodes:

CompletionStatement

A statement that indicates the completion records. In other words, they define the control flow of the program, such as when should a loop break or an action throws critical errors.

JavaScript

  1. t.isCompletionStatement(node);

Covered nodes:

Conditional

A cover of ConditionalExpression and IfStatement, which share the same AST shape.

JavaScript

  1. t.isConditional(node);

Covered nodes:

Declaration

A cover of any Declarations.

JavaScript

  1. t.isDeclaration(node);

Covered nodes:

EnumBody

A cover of Flow enum bodies.

JavaScript

  1. t.isEnumBody(node);

Covered nodes:

EnumMember

A cover of Flow enum members.

JavaScript

  1. t.isEnumMember(node);

Covered nodes:

ExportDeclaration

A cover of any ExportDeclarations.

JavaScript

  1. t.isExportDeclaration(node);

Covered nodes:

Expression

A cover of any Expressions.

JavaScript

  1. t.isExpression(node);

Covered nodes:

ExpressionWrapper

A wrapper of expression that does not have runtime semantics.

JavaScript

  1. t.isExpressionWrapper(node);

Covered nodes:

Flow

A cover of AST nodes defined for Flow.

JavaScript

  1. t.isFlow(node);

Covered nodes:

FlowBaseAnnotation

A cover of primary Flow type annotations.

JavaScript

  1. t.isFlowBaseAnnotation(node);

Covered nodes:

FlowDeclaration

A cover of Flow declarations.

JavaScript

  1. t.isFlowDeclaration(node);

Covered nodes:

FlowPredicate

A cover of Flow predicates.

JavaScript

  1. t.isFlowPredicate(node);

Covered nodes:

FlowType

A cover of Flow type annotations.

JavaScript

  1. t.isFlowType(node);

Covered nodes:

For

A cover of ForStatements and ForXStatements.

JavaScript

  1. t.isFor(node);

Covered nodes:

ForXStatement

A cover of ForInStatements and ForOfStatements.

JavaScript

  1. t.isForXStatement(node);

Covered nodes:

Function

A cover of functions and methods, the must have body and params. Note: Function is different to FunctionParent. For example, a StaticBlock is a FunctionParent but not Function.

JavaScript

  1. t.isFunction(node);

Covered nodes:

FunctionParent

A cover of AST nodes that start an execution context with new VariableEnvironment. In other words, they define the scope of var declarations. FunctionParent did not include Program since Babel 7.

JavaScript

  1. t.isFunctionParent(node);

Covered nodes:

Immutable

A cover of immutable objects and JSX elements. An object is immutable if no other properties can be defined once created.

JavaScript

  1. t.isImmutable(node);

Covered nodes:

ImportOrExportDeclaration

History

VersionChanges
v7.21.0Introduced

A cover of ImportDeclaration and ExportDeclaration.

JavaScript

  1. t.isImportOrExportDeclaration(node);

Covered nodes:

JSX

A cover of AST nodes defined for JSX.

JavaScript

  1. t.isJSX(node);

Covered nodes:

LVal

A cover of left hand side expressions used in the left of assignment expressions and ForXStatements.

JavaScript

  1. t.isLVal(node);

Covered nodes:

Literal

A cover of Literals, Regular Expression Literals and Template Literals.

JavaScript

  1. t.isLiteral(node);

Covered nodes:

Loop

A cover of loop statements.

JavaScript

  1. t.isLoop(node);

Covered nodes:

Method

A cover of object methods and class methods.

JavaScript

  1. t.isMethod(node);

Covered nodes:

Miscellaneous

A cover of non-standard AST types that are sometimes useful for development.

JavaScript

  1. t.isMiscellaneous(node);

Covered nodes:

ModuleDeclaration

History

VersionChanges
v7.21.0Deprecated

@babel/types - 图1caution

Deprecated, use ImportOrExportDeclaration instead. Check out PR #15266 for migration notes.

JavaScript

  1. t.isModuleDeclaration(node);

Covered nodes:

ModuleSpecifier

A cover of import and export specifiers. Note: It is not the ModuleSpecifier defined in the spec.

JavaScript

  1. t.isModuleSpecifier(node);

Covered nodes:

ObjectMember

A cover of members in an object literal.

JavaScript

  1. t.isObjectMember(node);

Covered nodes:

Pattern

A cover of BindingPattern except Identifiers.

JavaScript

  1. t.isPattern(node);

Covered nodes:

PatternLike

A cover of BindingPatterns.

JavaScript

  1. t.isPatternLike(node);

Covered nodes:

Private

A cover of private class elements and private identifiers.

JavaScript

  1. t.isPrivate(node);

Covered nodes:

Property

A cover of object properties and class properties.

JavaScript

  1. t.isProperty(node);

Covered nodes:

Pureish

A cover of AST nodes which do not have side-effects. In other words, there is no observable behaviour changes if they are evaluated more than once.

JavaScript

  1. t.isPureish(node);

Covered nodes:

Scopable

A cover of FunctionParent and BlockParent.

JavaScript

  1. t.isScopable(node);

Covered nodes:

Standardized

A cover of AST nodes which are part of an official ECMAScript specification.

JavaScript

  1. t.isStandardized(node);

Covered nodes:

Statement

A cover of any Statements.

JavaScript

  1. t.isStatement(node);

Covered nodes:

TSBaseType

A cover of primary TypeScript type annotations.

JavaScript

  1. t.isTSBaseType(node);

Covered nodes:

TSEntityName

A cover of ts entities.

JavaScript

  1. t.isTSEntityName(node);

Covered nodes:

TSType

A cover of TypeScript type annotations.

JavaScript

  1. t.isTSType(node);

Covered nodes:

TSTypeElement

A cover of TypeScript type declarations.

JavaScript

  1. t.isTSTypeElement(node);

Covered nodes:

Terminatorless

A cover of AST nodes whose semantic will change when a line terminator is inserted between the operator and the operand.

JavaScript

  1. t.isTerminatorless(node);

Covered nodes:

TypeScript

A cover of AST nodes defined for TypeScript.

JavaScript

  1. t.isTypeScript(node);

Covered nodes:

UnaryLike

A cover of UnaryExpression and SpreadElement.

JavaScript

  1. t.isUnaryLike(node);

Covered nodes:

UserWhitespacable

Deprecated. Will be removed in Babel 8.

JavaScript

  1. t.isUserWhitespacable(node);

Covered nodes:

While

A cover of DoWhileStatement and WhileStatement, which share the same AST shape.

JavaScript

  1. t.isWhile(node);

Covered nodes: