Skip to main content

@babel/types

这个模块包含了手动构建 AST 的方法以及检查 AST 节点类型的方法。

安装​

🌐 Install

npm install --save-dev @babel/types

应用接口​

🌐 API

Node 构建器​

🌐 Node Builders

anyTypeAnnotation​

JavaScript
t.anyTypeAnnotation();

另见 t.isAnyTypeAnnotation(node, opts) 和 t.assertAnyTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


argumentPlaceholder​

JavaScript
t.argumentPlaceholder();

另见 t.isArgumentPlaceholder(node, opts) 和 t.assertArgumentPlaceholder(node, opts)。

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


arrayExpression​

JavaScript
t.arrayExpression(elements);

另见 t.isArrayExpression(node, opts) 和 t.assertArrayExpression(node, opts)。

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

AST 节点 ArrayExpression 的形状:

🌐 AST Node ArrayExpression shape:

  • elements:(null | Expression | SpreadElement)[](默认:[])

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


arrayPattern​

JavaScript
t.arrayPattern(elements);

另见 t.isArrayPattern(node, opts) 和 t.assertArrayPattern(node, opts)。

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

AST 节点 ArrayPattern 的形状:

🌐 AST Node ArrayPattern shape:

  • elements:(null | PatternLike)[](必填)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)

别名: Standardized, FunctionParameter, Pattern, PatternLike, LVal

🌐 Aliases: Standardized, FunctionParameter, Pattern, PatternLike, LVal


arrayTypeAnnotation​

JavaScript
t.arrayTypeAnnotation(elementType);

另见 t.isArrayTypeAnnotation(node, opts) 和 t.assertArrayTypeAnnotation(node, opts)。

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

AST 节点 ArrayTypeAnnotation 的形状:

🌐 AST Node ArrayTypeAnnotation shape:

  • elementType:FlowType(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


arrowFunctionExpression​

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

另见 t.isArrowFunctionExpression(node, opts) 和 t.assertArrowFunctionExpression(node, opts)。

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

AST 节点 ArrowFunctionExpression 的形状:

🌐 AST Node ArrowFunctionExpression shape:

  • params:FunctionParameter[](必填)
  • body:BlockStatement | Expression(必填)
  • async:boolean(默认:false)
  • expression:boolean(必填)
  • generator:boolean(默认:false,从构建函数中排除)
  • predicate:DeclaredPredicate | InferredPredicate(默认:null,从构建函数中排除)
  • returnType:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名: Standardized, Scopable, Function, BlockParent, FunctionParent, Expression, Pureish

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


assignmentExpression​

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

另见 t.isAssignmentExpression(node, opts) 和 t.assertAssignmentExpression(node, opts)。

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

AST 节点 AssignmentExpression 的形状:

🌐 AST Node AssignmentExpression shape:

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

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


assignmentPattern​

JavaScript
t.assignmentPattern(left, right);

另见 t.isAssignmentPattern(node, opts) 和 t.assertAssignmentPattern(node, opts)。

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

AST 节点 AssignmentPattern 的形状:

🌐 AST Node AssignmentPattern shape:

  • left:Identifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression(必填)
  • right:Expression(必填)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)

别名: Standardized, FunctionParameter, Pattern, PatternLike, LVal

🌐 Aliases: Standardized, FunctionParameter, Pattern, PatternLike, LVal


awaitExpression​

JavaScript
t.awaitExpression(argument);

另见 t.isAwaitExpression(node, opts) 和 t.assertAwaitExpression(node, opts)。

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

AST 节点 AwaitExpression 的形状:

🌐 AST Node AwaitExpression shape:

  • argument:Expression(必填)

别名: Standardized, Expression, Terminatorless

🌐 Aliases: Standardized, Expression, Terminatorless


bigIntLiteral​

JavaScript
t.bigIntLiteral(value);

另见 t.isBigIntLiteral(node, opts) 和 t.assertBigIntLiteral(node, opts)。

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

AST 节点 BigIntLiteral 的形状:

🌐 AST Node BigIntLiteral shape:

  • value:string(必填)

别名: Standardized, Expression, Pureish, Literal, Immutable

🌐 Aliases: Standardized, Expression, Pureish, Literal, Immutable


binaryExpression​

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

另见 t.isBinaryExpression(node, opts) 和 t.assertBinaryExpression(node, opts)。

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

AST 节点 BinaryExpression 的形状:

🌐 AST Node BinaryExpression shape:

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

别名: Standardized, Binary, Expression

🌐 Aliases: Standardized, Binary, Expression


bindExpression​

JavaScript
t.bindExpression(object, callee);

另见 t.isBindExpression(node, opts) 和 t.assertBindExpression(node, opts)。

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

AST 节点 BindExpression 的形状:

🌐 AST Node BindExpression shape:

  • object:Expression(必填)
  • callee:Expression(必填)

别名: Expression

🌐 Aliases: Expression


blockStatement​

JavaScript
t.blockStatement(body, directives);

另见 t.isBlockStatement(node, opts) 和 t.assertBlockStatement(node, opts)。

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

AST 节点 BlockStatement 的形状:

🌐 AST Node BlockStatement shape:

  • body:Statement[](必填)
  • directives:Directive[](默认:[])

别名: Standardized, Scopable, BlockParent, Block, Statement

🌐 Aliases: Standardized, Scopable, BlockParent, Block, Statement


booleanLiteral​

JavaScript
t.booleanLiteral(value);

另见 t.isBooleanLiteral(node, opts) 和 t.assertBooleanLiteral(node, opts)。

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

AST 节点 BooleanLiteral 的形状:

🌐 AST Node BooleanLiteral shape:

  • value:boolean(必填)

别名: Standardized, Expression, Pureish, Literal, Immutable

🌐 Aliases: Standardized, Expression, Pureish, Literal, Immutable


booleanLiteralTypeAnnotation​

JavaScript
t.booleanLiteralTypeAnnotation(value);

另见 t.isBooleanLiteralTypeAnnotation(node, opts) 和 t.assertBooleanLiteralTypeAnnotation(node, opts)。

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

AST 节点 BooleanLiteralTypeAnnotation 的形状:

🌐 AST Node BooleanLiteralTypeAnnotation shape:

  • value:boolean(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


booleanTypeAnnotation​

JavaScript
t.booleanTypeAnnotation();

另见 t.isBooleanTypeAnnotation(node, opts) 和 t.assertBooleanTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


breakStatement​

JavaScript
t.breakStatement(label);

另见 t.isBreakStatement(node, opts) 和 t.assertBreakStatement(node, opts)。

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

AST 节点 BreakStatement 的形状:

🌐 AST Node BreakStatement shape:

  • label:Identifier(默认:null)

别名: Standardized, Statement, Terminatorless, CompletionStatement

🌐 Aliases: Standardized, Statement, Terminatorless, CompletionStatement


callExpression​

JavaScript
t.callExpression(callee, arguments);

另见 t.isCallExpression(node, opts) 和 t.assertCallExpression(node, opts)。

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

AST 节点 CallExpression 的形状:

🌐 AST Node CallExpression shape:

  • callee:Expression | Super | V8IntrinsicIdentifier(必填)
  • arguments:(Expression | SpreadElement | ArgumentPlaceholder)[](必填)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeArguments:TypeParameterInstantiation(默认:null,从构建函数中排除)
  • typeParameters:TSTypeParameterInstantiation(默认:null,从构建函数中排除)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


catchClause​

JavaScript
t.catchClause(param, body);

另见 t.isCatchClause(node, opts) 和 t.assertCatchClause(node, opts)。

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

AST 节点 CatchClause 的形状:

🌐 AST Node CatchClause shape:

  • param:Identifier | ArrayPattern | ObjectPattern(默认:null)
  • body:BlockStatement(必填)

别名: Standardized, Scopable, BlockParent

🌐 Aliases: Standardized, Scopable, BlockParent


classAccessorProperty​

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

另见 t.isClassAccessorProperty(node, opts) 和 t.assertClassAccessorProperty(node, opts)。

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

AST 节点 ClassAccessorProperty 的形状:

🌐 AST Node ClassAccessorProperty shape:

  • key:Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName(必填)
  • value:Expression(默认:null)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null)
  • decorators:Decorator[](默认:null)
  • computed:boolean(默认:false)
  • static:boolean(默认:false)
  • abstract:boolean(默认:null,从构建函数中排除)
  • accessibility:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • declare:boolean(默认:null,从构建函数中排除)
  • definite:boolean(默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • override:boolean(默认:false,从构建函数中排除)
  • readonly:boolean(默认:null,从构建函数中排除)
  • variance:Variance(默认:null,从构建函数中排除)

别名: Standardized, Property, Accessor

🌐 Aliases: Standardized, Property, Accessor


classBody​

JavaScript
t.classBody(body);

另见 t.isClassBody(node, opts) 和 t.assertClassBody(node, opts)。

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

AST 节点 ClassBody 的形状:

🌐 AST Node ClassBody shape:

  • body:(ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock)[](必填)

别名: Standardized

🌐 Aliases: Standardized


classDeclaration​

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

另见 t.isClassDeclaration(node, opts) 和 t.assertClassDeclaration(node, opts)。

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

AST 节点 ClassDeclaration 的形状:

🌐 AST Node ClassDeclaration shape:

  • id:Identifier(默认:null)
  • superClass:Expression(默认:null)
  • body:ClassBody(必填)
  • decorators:Decorator[](默认:null)
  • abstract:boolean(默认:null,从构建函数中排除)
  • declare:boolean(默认:null,从构建函数中排除)
  • implements:(TSExpressionWithTypeArguments | ClassImplements)[](默认:null,从构建函数中排除)
  • mixins:InterfaceExtends(默认:null,从构建函数中排除)
  • superTypeParameters:TypeParameterInstantiation | TSTypeParameterInstantiation(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名: Standardized, Scopable, Class, Statement, Declaration

🌐 Aliases: Standardized, Scopable, Class, Statement, Declaration


classExpression​

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

另见 t.isClassExpression(node, opts) 和 t.assertClassExpression(node, opts)。

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

AST 节点 ClassExpression 的形状:

🌐 AST Node ClassExpression shape:

  • id:Identifier(默认:null)
  • superClass:Expression(默认:null)
  • body:ClassBody(必填)
  • decorators:Decorator[](默认:null)
  • implements:(TSExpressionWithTypeArguments | ClassImplements)[](默认:null,从构建函数中排除)
  • mixins:InterfaceExtends(默认:null,从构建函数中排除)
  • superTypeParameters:TypeParameterInstantiation | TSTypeParameterInstantiation(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名:Standardized, Scopable, Class, Expression

🌐 Aliases: Standardized, Scopable, Class, Expression


classImplements​

JavaScript
t.classImplements(id, typeParameters);

另见 t.isClassImplements(node, opts) 和 t.assertClassImplements(node, opts)。

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

AST 节点 ClassImplements 的形状:

🌐 AST Node ClassImplements shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterInstantiation(默认:null)

别名: Flow

🌐 Aliases: Flow


classMethod​

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

另见 t.isClassMethod(node, opts) 和 t.assertClassMethod(node, opts)。

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

AST 节点 ClassMethod 的形状:

🌐 AST Node ClassMethod shape:

  • kind:"get" | "set" | "method" | "constructor"(默认:'method')
  • key:如果已计算则 Expression,否则 Identifier | Literal(必填)
  • params:(FunctionParameter | TSParameterProperty)[](必填)
  • body:BlockStatement(必填)
  • computed:boolean(默认:false)
  • static:boolean(默认:false)
  • generator:boolean(默认:false)
  • async:boolean(默认:false)
  • abstract:boolean(默认:null,从构建函数中排除)
  • access:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • accessibility:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • override:boolean(默认:false,从构建函数中排除)
  • returnType:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名: Standardized, Function, Scopable, BlockParent, FunctionParent, Method

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


classPrivateMethod​

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

另见 t.isClassPrivateMethod(node, opts) 和 t.assertClassPrivateMethod(node, opts)。

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

AST 节点 ClassPrivateMethod 的形状:

🌐 AST Node ClassPrivateMethod shape:

  • kind:"get" | "set" | "method"(默认:'method')
  • key:PrivateName(必填)
  • params:(FunctionParameter | TSParameterProperty)[](必填)
  • body:BlockStatement(必填)
  • static:boolean(默认:false)
  • abstract:boolean(默认:null,从构建函数中排除)
  • access:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • accessibility:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • async:boolean(默认:false,从构建函数中排除)
  • computed:'false'(默认值:false,从构建器函数中排除)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • generator:boolean(默认:false,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • override:boolean(默认:false,从构建函数中排除)
  • returnType:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名: Standardized, Function, Scopable, BlockParent, FunctionParent, Method, Private

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


classPrivateProperty​

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

另见 t.isClassPrivateProperty(node, opts) 和 t.assertClassPrivateProperty(node, opts)。

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

AST 节点 ClassPrivateProperty 的形状:

🌐 AST Node ClassPrivateProperty shape:

  • key:PrivateName(必填)
  • value:Expression(默认:null)
  • decorators:Decorator[](默认:null)
  • static:boolean(默认:false)
  • definite:boolean(默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • readonly:boolean(默认:null,从构建函数中排除)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)
  • variance:Variance(默认:null,从构建函数中排除)

别名: Standardized, Property, Private

🌐 Aliases: Standardized, Property, Private


classProperty​

JavaScript
t.classProperty(key, value, typeAnnotation, decorators, computed, static);
历史
版本变更
v7.6.0支持 static

另见 t.isClassProperty(node, opts) 和 t.assertClassProperty(node, opts)。

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

AST 节点 ClassProperty 的形状:

🌐 AST Node ClassProperty shape:

  • key:Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression(必填)
  • value:Expression(默认:null)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null)
  • decorators:Decorator[](默认:null)
  • computed:boolean(默认:false)
  • static:boolean(默认:false)
  • abstract:boolean(默认:null,从构建函数中排除)
  • accessibility:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • declare:boolean(默认:null,从构建函数中排除)
  • definite:boolean(默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • override:boolean(默认:false,从构建函数中排除)
  • readonly:boolean(默认:null,从构建函数中排除)
  • variance:Variance(默认:null,从构建函数中排除)

别名:Standardized,Property

🌐 Aliases: Standardized, Property


conditionalExpression​

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

另见 t.isConditionalExpression(node, opts) 和 t.assertConditionalExpression(node, opts)。

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

AST 节点 ConditionalExpression 的形状:

🌐 AST Node ConditionalExpression shape:

  • test:Expression(必填)
  • consequent:Expression(必填)
  • alternate:Expression(必填)

别名: Standardized, Expression, Conditional

🌐 Aliases: Standardized, Expression, Conditional


continueStatement​

JavaScript
t.continueStatement(label);

另见 t.isContinueStatement(node, opts) 和 t.assertContinueStatement(node, opts)。

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

AST 节点 ContinueStatement 的形状:

🌐 AST Node ContinueStatement shape:

  • label:Identifier(默认:null)

别名: Standardized, Statement, Terminatorless, CompletionStatement

🌐 Aliases: Standardized, Statement, Terminatorless, CompletionStatement


debuggerStatement​

JavaScript
t.debuggerStatement();

另见 t.isDebuggerStatement(node, opts) 和 t.assertDebuggerStatement(node, opts)。

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

别名:Standardized,Statement

🌐 Aliases: Standardized, Statement


decimalLiteral​

JavaScript
t.decimalLiteral(value);

另见 t.isDecimalLiteral(node, opts) 和 t.assertDecimalLiteral(node, opts)。

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

AST 节点 DecimalLiteral 的形状:

🌐 AST Node DecimalLiteral shape:

  • value:string(必填)

别名:Expression, Pureish, Literal, Immutable

🌐 Aliases: Expression, Pureish, Literal, Immutable


declareClass​

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

另见 t.isDeclareClass(node, opts) 和 t.assertDeclareClass(node, opts)。

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

AST 节点 DeclareClass 的形状:

🌐 AST Node DeclareClass shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterDeclaration(默认:null)
  • extends:InterfaceExtends[](默认:null)
  • body:ObjectTypeAnnotation(必填)
  • implements:ClassImplements[](默认:null,从构建函数中排除)
  • mixins:InterfaceExtends[](默认:null,从构建函数中排除)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareExportAllDeclaration​

JavaScript
t.declareExportAllDeclaration(source, attributes);

另见 t.isDeclareExportAllDeclaration(node, opts) 和 t.assertDeclareExportAllDeclaration(node, opts)。

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

AST 节点 DeclareExportAllDeclaration 的形状:

🌐 AST Node DeclareExportAllDeclaration shape:

  • source:StringLiteral(必填)
  • attributes:ImportAttribute[](默认:null)
  • assertions:ImportAttribute[](默认:null,从构建函数中排除)
  • exportKind:"type" | "value"(默认:null,从构建函数中排除)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareExportDeclaration​

JavaScript
t.declareExportDeclaration(declaration, specifiers, source, attributes);

另见 t.isDeclareExportDeclaration(node, opts) 和 t.assertDeclareExportDeclaration(node, opts)。

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

AST 节点 DeclareExportDeclaration 的形状:

🌐 AST Node DeclareExportDeclaration shape:

  • declaration:Flow(默认:null)
  • specifiers:(ExportSpecifier | ExportNamespaceSpecifier)[](默认:null)
  • source:StringLiteral(默认:null)
  • attributes:ImportAttribute[](默认:null)
  • assertions:ImportAttribute[](默认:null,从构建函数中排除)
  • default:boolean(默认:null,从构建函数中排除)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareFunction​

JavaScript
t.declareFunction(id);

另见 t.isDeclareFunction(node, opts) 和 t.assertDeclareFunction(node, opts)。

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

AST 节点 DeclareFunction 的形状:

🌐 AST Node DeclareFunction shape:

  • id:Identifier(必填)
  • predicate:DeclaredPredicate(默认:null,从构建函数中排除)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareInterface​

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

另见 t.isDeclareInterface(node, opts) 和 t.assertDeclareInterface(node, opts)。

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

AST 节点 DeclareInterface 的形状:

🌐 AST Node DeclareInterface shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterDeclaration(默认:null)
  • extends:InterfaceExtends[](默认:null)
  • body:ObjectTypeAnnotation(必填)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareModule​

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

另见 t.isDeclareModule(node, opts) 和 t.assertDeclareModule(node, opts)。

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

AST 节点 DeclareModule 的形状:

🌐 AST Node DeclareModule shape:

  • id:Identifier | StringLiteral(必填)
  • body:BlockStatement(必填)
  • kind:"CommonJS" | "ES"(默认:null)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareModuleExports​

JavaScript
t.declareModuleExports(typeAnnotation);

另见 t.isDeclareModuleExports(node, opts) 和 t.assertDeclareModuleExports(node, opts)。

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

AST 节点 DeclareModuleExports 的形状:

🌐 AST Node DeclareModuleExports shape:

  • typeAnnotation:TypeAnnotation(必填)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareOpaqueType​

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

另见 t.isDeclareOpaqueType(node, opts) 和 t.assertDeclareOpaqueType(node, opts)。

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

AST 节点 DeclareOpaqueType 的形状:

🌐 AST Node DeclareOpaqueType shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterDeclaration(默认:null)
  • supertype:FlowType(默认:null)
  • impltype:FlowType(默认:null,从构建函数中排除)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareTypeAlias​

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

另见 t.isDeclareTypeAlias(node, opts) 和 t.assertDeclareTypeAlias(node, opts)。

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

AST 节点 DeclareTypeAlias 的形状:

🌐 AST Node DeclareTypeAlias shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterDeclaration(默认:null)
  • right:FlowType(必填)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declareVariable​

JavaScript
t.declareVariable(id);

另见 t.isDeclareVariable(node, opts) 和 t.assertDeclareVariable(node, opts)。

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

AST 节点 DeclareVariable 的形状:

🌐 AST Node DeclareVariable shape:

  • id:Identifier(必填)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


declaredPredicate​

JavaScript
t.declaredPredicate(value);

另见 t.isDeclaredPredicate(node, opts) 和 t.assertDeclaredPredicate(node, opts)。

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

AST 节点 DeclaredPredicate 的形状:

🌐 AST Node DeclaredPredicate shape:

  • value:Flow(必填)

别名:Flow,FlowPredicate

🌐 Aliases: Flow, FlowPredicate


decorator​

JavaScript
t.decorator(expression);

另见 t.isDecorator(node, opts) 和 t.assertDecorator(node, opts)。

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

AST 节点 Decorator 的形状:

🌐 AST Node Decorator shape:

  • expression:Expression(必填)

directive​

JavaScript
t.directive(value);

另见 t.isDirective(node, opts) 和 t.assertDirective(node, opts)。

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

AST 节点 Directive 的形状:

🌐 AST Node Directive shape:

  • value:DirectiveLiteral(必填)

别名: Standardized

🌐 Aliases: Standardized


directiveLiteral​

JavaScript
t.directiveLiteral(value);

另见 t.isDirectiveLiteral(node, opts) 和 t.assertDirectiveLiteral(node, opts)。

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

AST 节点 DirectiveLiteral 的形状:

🌐 AST Node DirectiveLiteral shape:

  • value:string(必填)

别名: Standardized

🌐 Aliases: Standardized


doExpression​

JavaScript
t.doExpression(body, async);

另见 t.isDoExpression(node, opts) 和 t.assertDoExpression(node, opts)。

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

AST 节点 DoExpression 的形状:

🌐 AST Node DoExpression shape:

  • body:BlockStatement(必填)
  • async:boolean(默认:false)

别名: Expression

🌐 Aliases: Expression


doWhileStatement​

JavaScript
t.doWhileStatement(test, body);

另见 t.isDoWhileStatement(node, opts) 和 t.assertDoWhileStatement(node, opts)。

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

AST 节点 DoWhileStatement 的形状:

🌐 AST Node DoWhileStatement shape:

  • test:Expression(必填)
  • body:Statement(必填)

别名: Standardized, Statement, BlockParent, Loop, While, Scopable

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


emptyStatement​

JavaScript
t.emptyStatement();

另见 t.isEmptyStatement(node, opts) 和 t.assertEmptyStatement(node, opts)。

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

别名:Standardized,Statement

🌐 Aliases: Standardized, Statement


emptyTypeAnnotation​

JavaScript
t.emptyTypeAnnotation();

另见 t.isEmptyTypeAnnotation(node, opts) 和 t.assertEmptyTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


enumBooleanBody​

JavaScript
t.enumBooleanBody(members);

另见 t.isEnumBooleanBody(node, opts) 和 t.assertEnumBooleanBody(node, opts)。

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

AST 节点 EnumBooleanBody 的形状:

🌐 AST Node EnumBooleanBody shape:

  • members:EnumBooleanMember[](必填)
  • explicitType:boolean(必填)
  • hasUnknownMembers:boolean(必填)

别名:Flow,EnumBody

🌐 Aliases: Flow, EnumBody


enumBooleanMember​

JavaScript
t.enumBooleanMember(id);

另见 t.isEnumBooleanMember(node, opts) 和 t.assertEnumBooleanMember(node, opts)。

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

AST 节点 EnumBooleanMember 的形状:

🌐 AST Node EnumBooleanMember shape:

  • id:Identifier(必填)
  • init:BooleanLiteral(必填)

别名:Flow,EnumMember

🌐 Aliases: Flow, EnumMember


enumDeclaration​

JavaScript
t.enumDeclaration(id, body);

另见 t.isEnumDeclaration(node, opts) 和 t.assertEnumDeclaration(node, opts)。

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

AST 节点 EnumDeclaration 的形状:

🌐 AST Node EnumDeclaration shape:

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

别名: Flow, Statement, Declaration

🌐 Aliases: Flow, Statement, Declaration


enumDefaultedMember​

JavaScript
t.enumDefaultedMember(id);

另见 t.isEnumDefaultedMember(node, opts) 和 t.assertEnumDefaultedMember(node, opts)。

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

AST 节点 EnumDefaultedMember 的形状:

🌐 AST Node EnumDefaultedMember shape:

  • id:Identifier(必填)

别名:Flow,EnumMember

🌐 Aliases: Flow, EnumMember


enumNumberBody​

JavaScript
t.enumNumberBody(members);

另见 t.isEnumNumberBody(node, opts) 和 t.assertEnumNumberBody(node, opts)。

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

AST 节点 EnumNumberBody 的形状:

🌐 AST Node EnumNumberBody shape:

  • members:EnumNumberMember[](必填)
  • explicitType:boolean(必填)
  • hasUnknownMembers:boolean(必填)

别名:Flow,EnumBody

🌐 Aliases: Flow, EnumBody


enumNumberMember​

JavaScript
t.enumNumberMember(id, init);

另见 t.isEnumNumberMember(node, opts) 和 t.assertEnumNumberMember(node, opts)。

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

AST 节点 EnumNumberMember 的形状:

🌐 AST Node EnumNumberMember shape:

  • id:Identifier(必填)
  • init:NumericLiteral(必填)

别名:Flow,EnumMember

🌐 Aliases: Flow, EnumMember


enumStringBody​

JavaScript
t.enumStringBody(members);

另见 t.isEnumStringBody(node, opts) 和 t.assertEnumStringBody(node, opts)。

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

AST 节点 EnumStringBody 的形状:

🌐 AST Node EnumStringBody shape:

  • members:(EnumStringMember | EnumDefaultedMember)[](必填)
  • explicitType:boolean(必填)
  • hasUnknownMembers:boolean(必填)

别名:Flow,EnumBody

🌐 Aliases: Flow, EnumBody


enumStringMember​

JavaScript
t.enumStringMember(id, init);

另见 t.isEnumStringMember(node, opts) 和 t.assertEnumStringMember(node, opts)。

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

AST 节点 EnumStringMember 的形状:

🌐 AST Node EnumStringMember shape:

  • id:Identifier(必填)
  • init:StringLiteral(必填)

别名:Flow,EnumMember

🌐 Aliases: Flow, EnumMember


enumSymbolBody​

JavaScript
t.enumSymbolBody(members);

另见 t.isEnumSymbolBody(node, opts) 和 t.assertEnumSymbolBody(node, opts)。

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

AST 节点 EnumSymbolBody 的形状:

🌐 AST Node EnumSymbolBody shape:

  • members:EnumDefaultedMember[](必填)
  • hasUnknownMembers:boolean(必填)

别名:Flow,EnumBody

🌐 Aliases: Flow, EnumBody


existsTypeAnnotation​

JavaScript
t.existsTypeAnnotation();

另见 t.isExistsTypeAnnotation(node, opts) 和 t.assertExistsTypeAnnotation(node, opts)。

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

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


exportAllDeclaration​

JavaScript
t.exportAllDeclaration(source, attributes);
历史
版本变更
v7.29.0支持 attributes

另见 t.isExportAllDeclaration(node, opts) 和 t.assertExportAllDeclaration(node, opts)。

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

AST 节点 ExportAllDeclaration 的形状:

🌐 AST Node ExportAllDeclaration shape:

  • source:StringLiteral(必填)
  • attributes:ImportAttribute[](默认:null)
  • assertions:ImportAttribute[](默认:null,从构建函数中排除)
  • exportKind:"type" | "value"(默认:null,从构建函数中排除)

别名: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration

🌐 Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportDefaultDeclaration​

JavaScript
t.exportDefaultDeclaration(declaration);

另见 t.isExportDefaultDeclaration(node, opts) 和 t.assertExportDefaultDeclaration(node, opts)。

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

AST 节点 ExportDefaultDeclaration 的形状:

🌐 AST Node ExportDefaultDeclaration shape:

  • declaration:TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression(必填)
  • exportKind:"value"(默认:null,从构建函数中排除)

别名: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration

🌐 Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportDefaultSpecifier​

JavaScript
t.exportDefaultSpecifier(exported);

另见 t.isExportDefaultSpecifier(node, opts) 和 t.assertExportDefaultSpecifier(node, opts)。

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

AST 节点 ExportDefaultSpecifier 的形状:

🌐 AST Node ExportDefaultSpecifier shape:

  • exported:Identifier(必填)

别名: ModuleSpecifier

🌐 Aliases: ModuleSpecifier


exportNamedDeclaration​

JavaScript
t.exportNamedDeclaration(declaration, specifiers, source, attributes);
历史
版本变更
v7.29.0支持 attributes

另见 t.isExportNamedDeclaration(node, opts) 和 t.assertExportNamedDeclaration(node, opts)。

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

AST 节点 ExportNamedDeclaration 的形状:

🌐 AST Node ExportNamedDeclaration shape:

  • declaration:Declaration(默认:null)
  • specifiers:(ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[](默认:[])
  • source:StringLiteral(默认:null)
  • attributes:ImportAttribute[](默认:null)
  • assertions:ImportAttribute[](默认:null,从构建函数中排除)
  • exportKind:"type" | "value"(默认:null,从构建函数中排除)

别名: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration

🌐 Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportNamespaceSpecifier​

JavaScript
t.exportNamespaceSpecifier(exported);

另见 t.isExportNamespaceSpecifier(node, opts) 和 t.assertExportNamespaceSpecifier(node, opts)。

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

AST 节点 ExportNamespaceSpecifier 的形状:

🌐 AST Node ExportNamespaceSpecifier shape:

  • exported:Identifier(必填)

别名:Standardized, ModuleSpecifier

🌐 Aliases: Standardized, ModuleSpecifier


exportSpecifier​

JavaScript
t.exportSpecifier(local, exported);

另见 t.isExportSpecifier(node, opts) 和 t.assertExportSpecifier(node, opts)。

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

AST 节点 ExportSpecifier 的形状:

🌐 AST Node ExportSpecifier shape:

  • local:Identifier(必填)
  • exported:Identifier | StringLiteral(必填)
  • exportKind:"type" | "value"(默认:null,从构建函数中排除)

别名:Standardized, ModuleSpecifier

🌐 Aliases: Standardized, ModuleSpecifier


expressionStatement​

JavaScript
t.expressionStatement(expression);

另见 t.isExpressionStatement(node, opts) 和 t.assertExpressionStatement(node, opts)。

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

AST 节点 ExpressionStatement 的形状:

🌐 AST Node ExpressionStatement shape:

  • expression:Expression(必填)

别名: Standardized, Statement, ExpressionWrapper

🌐 Aliases: Standardized, Statement, ExpressionWrapper


file​

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

另见 t.isFile(node, opts) 和 t.assertFile(node, opts)。

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

AST 节点 File 的形状:

🌐 AST Node File shape:

  • program:Program(必填)
  • comments:(CommentBlock | CommentLine)[](默认:null)
  • tokens:any[](默认:null)

别名: Standardized

🌐 Aliases: Standardized


forInStatement​

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

另见 t.isForInStatement(node, opts) 和 t.assertForInStatement(node, opts)。

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

AST 节点 ForInStatement 的形状:

🌐 AST Node ForInStatement shape:

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

别名: Standardized, Scopable, Statement, For, BlockParent, Loop, ForXStatement

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


forOfStatement​

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

另见 t.isForOfStatement(node, opts) 和 t.assertForOfStatement(node, opts)。

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

AST 节点 ForOfStatement 的形状:

🌐 AST Node ForOfStatement shape:

  • left:VariableDeclaration | LVal(必填)
  • right:Expression(必填)
  • body:Statement(必填)
  • await:boolean(默认:false)

别名: Standardized, Scopable, Statement, For, BlockParent, Loop, ForXStatement

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


forStatement​

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

另见 t.isForStatement(node, opts) 和 t.assertForStatement(node, opts)。

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

AST 节点 ForStatement 的形状:

🌐 AST Node ForStatement shape:

  • init:VariableDeclaration | Expression(默认:null)
  • test:Expression(默认:null)
  • update:Expression(默认:null)
  • body:Statement(必填)

别名: Standardized, Scopable, Statement, For, BlockParent, Loop

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


functionDeclaration​

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

另见 t.isFunctionDeclaration(node, opts) 和 t.assertFunctionDeclaration(node, opts)。

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

AST 节点 FunctionDeclaration 的形状:

🌐 AST Node FunctionDeclaration shape:

  • id:Identifier(默认:null)
  • params:FunctionParameter[](必填)
  • body:BlockStatement(必填)
  • generator:boolean(默认:false)
  • async:boolean(默认:false)
  • declare:boolean(默认:null,从构建函数中排除)
  • predicate:DeclaredPredicate | InferredPredicate(默认:null,从构建函数中排除)
  • returnType:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名: Standardized, Scopable, Function, BlockParent, FunctionParent, Statement, Pureish, Declaration

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


functionExpression​

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

另见 t.isFunctionExpression(node, opts) 和 t.assertFunctionExpression(node, opts)。

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

AST 节点 FunctionExpression 的形状:

🌐 AST Node FunctionExpression shape:

  • id:Identifier(默认:null)
  • params:FunctionParameter[](必填)
  • body:BlockStatement(必填)
  • generator:boolean(默认:false)
  • async:boolean(默认:false)
  • predicate:DeclaredPredicate | InferredPredicate(默认:null,从构建函数中排除)
  • returnType:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名: Standardized, Scopable, Function, BlockParent, FunctionParent, Expression, Pureish

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


functionTypeAnnotation​

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

另见 t.isFunctionTypeAnnotation(node, opts) 和 t.assertFunctionTypeAnnotation(node, opts)。

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

AST 节点 FunctionTypeAnnotation 的形状:

🌐 AST Node FunctionTypeAnnotation shape:

  • typeParameters:TypeParameterDeclaration(默认:null)
  • params:FunctionTypeParam[](必填)
  • rest:FunctionTypeParam(默认:null)
  • returnType:FlowType(必填)
  • this:FunctionTypeParam(默认:null,从构建函数中排除)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


functionTypeParam​

JavaScript
t.functionTypeParam(name, typeAnnotation);

另见 t.isFunctionTypeParam(node, opts) 和 t.assertFunctionTypeParam(node, opts)。

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

AST 节点 FunctionTypeParam 的形状:

🌐 AST Node FunctionTypeParam shape:

  • name:Identifier(默认:null)
  • typeAnnotation:FlowType(必填)
  • optional:boolean(默认:null,从构建函数中排除)

别名: Flow

🌐 Aliases: Flow


genericTypeAnnotation​

JavaScript
t.genericTypeAnnotation(id, typeParameters);

另见 t.isGenericTypeAnnotation(node, opts) 和 t.assertGenericTypeAnnotation(node, opts)。

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

AST 节点 GenericTypeAnnotation 的形状:

🌐 AST Node GenericTypeAnnotation shape:

  • id:Identifier | QualifiedTypeIdentifier(必填)
  • typeParameters:TypeParameterInstantiation(默认:null)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


identifier​

JavaScript
t.identifier(name);

另见 t.isIdentifier(node, opts) 和 t.assertIdentifier(node, opts)。

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

AST 节点 Identifier 的形状:

🌐 AST Node Identifier shape:

  • name:string(必填)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)

别名: Standardized, Expression, FunctionParameter, PatternLike, LVal, TSEntityName

🌐 Aliases: Standardized, Expression, FunctionParameter, PatternLike, LVal, TSEntityName


ifStatement​

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

另见 t.isIfStatement(node, opts) 和 t.assertIfStatement(node, opts)。

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

AST 节点 IfStatement 的形状:

🌐 AST Node IfStatement shape:

  • test:Expression(必填)
  • consequent:Statement(必填)
  • alternate:Statement(默认:null)

别名: Standardized, Statement, Conditional

🌐 Aliases: Standardized, Statement, Conditional


import​

JavaScript
t.import();

另见 t.isImport(node, opts) 和 t.assertImport(node, opts)。

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

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


importAttribute​

JavaScript
t.importAttribute(key, value);

另见 t.isImportAttribute(node, opts) 和 t.assertImportAttribute(node, opts)。

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

AST 节点 ImportAttribute 的形状:

🌐 AST Node ImportAttribute shape:

  • key:Identifier | StringLiteral(必填)
  • value:StringLiteral(必填)

别名: Standardized

🌐 Aliases: Standardized


importDeclaration​

JavaScript
t.importDeclaration(specifiers, source, attributes);
历史
版本变更
v7.20.0支持 module
v7.29.0支持 attributes

另见 t.isImportDeclaration(node, opts) 和 t.assertImportDeclaration(node, opts)。

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

AST 节点 ImportDeclaration 的形状:

🌐 AST Node ImportDeclaration shape:

  • specifiers:(ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[](必填)
  • source:StringLiteral(必填)
  • attributes:ImportAttribute[](默认:null)
  • assertions:ImportAttribute[](默认:null,从构建函数中排除)
  • importKind:"type" | "typeof" | "value"(默认:null,从构建函数中排除)
  • module:boolean(默认:null,从构建函数中排除)
  • phase:"source" | "defer"(默认:null,从构建函数中排除)

别名: Standardized, Statement, Declaration, ImportOrExportDeclaration

🌐 Aliases: Standardized, Statement, Declaration, ImportOrExportDeclaration


importDefaultSpecifier​

JavaScript
t.importDefaultSpecifier(local);

另见 t.isImportDefaultSpecifier(node, opts) 和 t.assertImportDefaultSpecifier(node, opts)。

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

AST 节点 ImportDefaultSpecifier 的形状:

🌐 AST Node ImportDefaultSpecifier shape:

  • local:Identifier(必填)

别名:Standardized, ModuleSpecifier

🌐 Aliases: Standardized, ModuleSpecifier


importExpression​

JavaScript
t.importExpression(source, options);

另见 t.isImportExpression(node, opts) 和 t.assertImportExpression(node, opts)。

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

AST 节点 ImportExpression 的形状:

🌐 AST Node ImportExpression shape:

  • source:Expression(必填)
  • options:Expression(默认:null)
  • phase:"source" | "defer"(默认:null,从构建函数中排除)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


importNamespaceSpecifier​

JavaScript
t.importNamespaceSpecifier(local);

另见 t.isImportNamespaceSpecifier(node, opts) 和 t.assertImportNamespaceSpecifier(node, opts)。

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

AST 节点 ImportNamespaceSpecifier 的形状:

🌐 AST Node ImportNamespaceSpecifier shape:

  • local:Identifier(必填)

别名:Standardized, ModuleSpecifier

🌐 Aliases: Standardized, ModuleSpecifier


importSpecifier​

JavaScript
t.importSpecifier(local, imported);

另见 t.isImportSpecifier(node, opts) 和 t.assertImportSpecifier(node, opts)。

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

AST 节点 ImportSpecifier 的形状:

🌐 AST Node ImportSpecifier shape:

  • local:Identifier(必填)
  • imported:Identifier | StringLiteral(必填)
  • importKind:"type" | "typeof" | "value"(默认:null,从构建函数中排除)

别名:Standardized, ModuleSpecifier

🌐 Aliases: Standardized, ModuleSpecifier


indexedAccessType​

JavaScript
t.indexedAccessType(objectType, indexType);

另见 t.isIndexedAccessType(node, opts) 和 t.assertIndexedAccessType(node, opts)。

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

AST 节点 IndexedAccessType 的形状:

🌐 AST Node IndexedAccessType shape:

  • objectType:FlowType(必填)
  • indexType:FlowType(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


inferredPredicate​

JavaScript
t.inferredPredicate();

另见 t.isInferredPredicate(node, opts) 和 t.assertInferredPredicate(node, opts)。

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

别名:Flow,FlowPredicate

🌐 Aliases: Flow, FlowPredicate


interfaceDeclaration​

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

另见 t.isInterfaceDeclaration(node, opts) 和 t.assertInterfaceDeclaration(node, opts)。

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

AST 节点 InterfaceDeclaration 的形状:

🌐 AST Node InterfaceDeclaration shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterDeclaration(默认:null)
  • extends:InterfaceExtends[](默认:null)
  • body:ObjectTypeAnnotation(必填)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


interfaceExtends​

JavaScript
t.interfaceExtends(id, typeParameters);

另见 t.isInterfaceExtends(node, opts) 和 t.assertInterfaceExtends(node, opts)。

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

AST 节点 InterfaceExtends 的形状:

🌐 AST Node InterfaceExtends shape:

  • id:Identifier | QualifiedTypeIdentifier(必填)
  • typeParameters:TypeParameterInstantiation(默认:null)

别名: Flow

🌐 Aliases: Flow


interfaceTypeAnnotation​

JavaScript
t.interfaceTypeAnnotation(extends, body);

另见 t.isInterfaceTypeAnnotation(node, opts) 和 t.assertInterfaceTypeAnnotation(node, opts)。

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

AST 节点 InterfaceTypeAnnotation 的形状:

🌐 AST Node InterfaceTypeAnnotation shape:

  • extends:InterfaceExtends[](默认:null)
  • body:ObjectTypeAnnotation(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


interpreterDirective​

JavaScript
t.interpreterDirective(value);

另见 t.isInterpreterDirective(node, opts) 和 t.assertInterpreterDirective(node, opts)。

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

AST 节点 InterpreterDirective 的形状:

🌐 AST Node InterpreterDirective shape:

  • value:string(必填)

别名: Standardized

🌐 Aliases: Standardized


intersectionTypeAnnotation​

JavaScript
t.intersectionTypeAnnotation(types);

另见 t.isIntersectionTypeAnnotation(node, opts) 和 t.assertIntersectionTypeAnnotation(node, opts)。

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

AST 节点 IntersectionTypeAnnotation 的形状:

🌐 AST Node IntersectionTypeAnnotation shape:

  • types:FlowType[](必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


jsxAttribute​

JavaScript
t.jsxAttribute(name, value);

另见 t.isJSXAttribute(node, opts) 和 t.assertJSXAttribute(node, opts)。

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

AST 节点 JSXAttribute 的形状:

🌐 AST Node JSXAttribute shape:

  • name:JSXIdentifier | JSXNamespacedName(必填)
  • value:JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer(默认:null)

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


jsxClosingElement​

JavaScript
t.jsxClosingElement(name);

另见 t.isJSXClosingElement(node, opts) 和 t.assertJSXClosingElement(node, opts)。

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

AST 节点 JSXClosingElement 的形状:

🌐 AST Node JSXClosingElement shape:

  • name:JSXIdentifier | JSXMemberExpression | JSXNamespacedName(必填)

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


jsxClosingFragment​

JavaScript
t.jsxClosingFragment();

另见 t.isJSXClosingFragment(node, opts) 和 t.assertJSXClosingFragment(node, opts)。

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

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


jsxElement​

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

另见 t.isJSXElement(node, opts) 和 t.assertJSXElement(node, opts)。

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

AST 节点 JSXElement 的形状:

🌐 AST Node JSXElement shape:

  • openingElement:JSXOpeningElement(必填)
  • closingElement:JSXClosingElement(默认:null)
  • children:(JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment)[](必填)
  • selfClosing:boolean(默认:null)

别名: JSX, Immutable, Expression

🌐 Aliases: JSX, Immutable, Expression


jsxEmptyExpression​

JavaScript
t.jsxEmptyExpression();

另见 t.isJSXEmptyExpression(node, opts) 和 t.assertJSXEmptyExpression(node, opts)。

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

别名: JSX

🌐 Aliases: JSX


jsxExpressionContainer​

JavaScript
t.jsxExpressionContainer(expression);

另见 t.isJSXExpressionContainer(node, opts) 和 t.assertJSXExpressionContainer(node, opts)。

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

AST 节点 JSXExpressionContainer 的形状:

🌐 AST Node JSXExpressionContainer shape:

  • expression:Expression | JSXEmptyExpression(必填)

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


jsxFragment​

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

另见 t.isJSXFragment(node, opts) 和 t.assertJSXFragment(node, opts)。

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

AST 节点 JSXFragment 的形状:

🌐 AST Node JSXFragment shape:

  • openingFragment:JSXOpeningFragment(必填)
  • closingFragment:JSXClosingFragment(必填)
  • children:(JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment)[](必填)

别名: JSX, Immutable, Expression

🌐 Aliases: JSX, Immutable, Expression


jsxIdentifier​

JavaScript
t.jsxIdentifier(name);

另见 t.isJSXIdentifier(node, opts) 和 t.assertJSXIdentifier(node, opts)。

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

AST 节点 JSXIdentifier 的形状:

🌐 AST Node JSXIdentifier shape:

  • name:string(必填)

别名: JSX

🌐 Aliases: JSX


jsxMemberExpression​

JavaScript
t.jsxMemberExpression(object, property);

另见 t.isJSXMemberExpression(node, opts) 和 t.assertJSXMemberExpression(node, opts)。

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

AST 节点 JSXMemberExpression 的形状:

🌐 AST Node JSXMemberExpression shape:

  • object:JSXMemberExpression | JSXIdentifier(必填)
  • property:JSXIdentifier(必填)

别名: JSX

🌐 Aliases: JSX


jsxNamespacedName​

JavaScript
t.jsxNamespacedName(namespace, name);

另见 t.isJSXNamespacedName(node, opts) 和 t.assertJSXNamespacedName(node, opts)。

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

AST 节点 JSXNamespacedName 的形状:

🌐 AST Node JSXNamespacedName shape:

  • namespace:JSXIdentifier(必填)
  • name:JSXIdentifier(必填)

别名: JSX

🌐 Aliases: JSX


jsxOpeningElement​

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

另见 t.isJSXOpeningElement(node, opts) 和 t.assertJSXOpeningElement(node, opts)。

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

AST 节点 JSXOpeningElement 的形状:

🌐 AST Node JSXOpeningElement shape:

  • name:JSXIdentifier | JSXMemberExpression | JSXNamespacedName(必填)
  • attributes:(JSXAttribute | JSXSpreadAttribute)[](必填)
  • selfClosing:boolean(默认:false)
  • typeArguments:TypeParameterInstantiation(默认:null,从构建函数中排除)
  • typeParameters:TSTypeParameterInstantiation(默认:null,从构建函数中排除)

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


jsxOpeningFragment​

JavaScript
t.jsxOpeningFragment();

另见 t.isJSXOpeningFragment(node, opts) 和 t.assertJSXOpeningFragment(node, opts)。

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

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


jsxSpreadAttribute​

JavaScript
t.jsxSpreadAttribute(argument);

另见 t.isJSXSpreadAttribute(node, opts) 和 t.assertJSXSpreadAttribute(node, opts)。

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

AST 节点 JSXSpreadAttribute 的形状:

🌐 AST Node JSXSpreadAttribute shape:

  • argument:Expression(必填)

别名: JSX

🌐 Aliases: JSX


jsxSpreadChild​

JavaScript
t.jsxSpreadChild(expression);

另见 t.isJSXSpreadChild(node, opts) 和 t.assertJSXSpreadChild(node, opts)。

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

AST 节点 JSXSpreadChild 的形状:

🌐 AST Node JSXSpreadChild shape:

  • expression:Expression(必填)

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


jsxText​

JavaScript
t.jsxText(value);

另见 t.isJSXText(node, opts) 和 t.assertJSXText(node, opts)。

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

AST 节点 JSXText 的形状:

🌐 AST Node JSXText shape:

  • value:string(必填)

别名:JSX,Immutable

🌐 Aliases: JSX, Immutable


labeledStatement​

JavaScript
t.labeledStatement(label, body);

另见 t.isLabeledStatement(node, opts) 和 t.assertLabeledStatement(node, opts)。

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

AST 节点 LabeledStatement 的形状:

🌐 AST Node LabeledStatement shape:

  • label:Identifier(必填)
  • body:Statement(必填)

别名:Standardized,Statement

🌐 Aliases: Standardized, Statement


logicalExpression​

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

另见 t.isLogicalExpression(node, opts) 和 t.assertLogicalExpression(node, opts)。

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

AST 节点 LogicalExpression 的形状:

🌐 AST Node LogicalExpression shape:

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

别名: Standardized, Binary, Expression

🌐 Aliases: Standardized, Binary, Expression


memberExpression​

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

另见 t.isMemberExpression(node, opts) 和 t.assertMemberExpression(node, opts)。

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

AST 节点 MemberExpression 的形状:

🌐 AST Node MemberExpression shape:

  • object:Expression | Super(必填)
  • property:如果已计算则 Expression,否则 Identifier(必填)
  • computed:boolean(默认:false)
  • optional:boolean(默认:null)

别名:Standardized, Expression, LVal, PatternLike

🌐 Aliases: Standardized, Expression, LVal, PatternLike


metaProperty​

JavaScript
t.metaProperty(meta, property);

另见 t.isMetaProperty(node, opts) 和 t.assertMetaProperty(node, opts)。

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

AST 节点 MetaProperty 的形状:

🌐 AST Node MetaProperty shape:

  • meta:Identifier(必填)
  • property:Identifier(必填)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


mixedTypeAnnotation​

JavaScript
t.mixedTypeAnnotation();

另见 t.isMixedTypeAnnotation(node, opts) 和 t.assertMixedTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


moduleExpression​

JavaScript
t.moduleExpression(body);

另见 t.isModuleExpression(node, opts) 和 t.assertModuleExpression(node, opts)。

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

AST 节点 ModuleExpression 的形状:

🌐 AST Node ModuleExpression shape:

  • body:Program(必填)

别名: Expression

🌐 Aliases: Expression


newExpression​

JavaScript
t.newExpression(callee, arguments);

另见 t.isNewExpression(node, opts) 和 t.assertNewExpression(node, opts)。

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

AST 节点 NewExpression 的形状:

🌐 AST Node NewExpression shape:

  • callee:Expression | Super | V8IntrinsicIdentifier(必填)
  • arguments:(Expression | SpreadElement | ArgumentPlaceholder)[](必填)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeArguments:TypeParameterInstantiation(默认:null,从构建函数中排除)
  • typeParameters:TSTypeParameterInstantiation(默认:null,从构建函数中排除)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


noop​

JavaScript
t.noop();

另见 t.isNoop(node, opts) 和 t.assertNoop(node, opts)。

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

别名: Miscellaneous

🌐 Aliases: Miscellaneous


nullLiteral​

JavaScript
t.nullLiteral();

另见 t.isNullLiteral(node, opts) 和 t.assertNullLiteral(node, opts)。

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

别名: Standardized, Expression, Pureish, Literal, Immutable

🌐 Aliases: Standardized, Expression, Pureish, Literal, Immutable


nullLiteralTypeAnnotation​

JavaScript
t.nullLiteralTypeAnnotation();

另见 t.isNullLiteralTypeAnnotation(node, opts) 和 t.assertNullLiteralTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


nullableTypeAnnotation​

JavaScript
t.nullableTypeAnnotation(typeAnnotation);

另见 t.isNullableTypeAnnotation(node, opts) 和 t.assertNullableTypeAnnotation(node, opts)。

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

AST 节点 NullableTypeAnnotation 的形状:

🌐 AST Node NullableTypeAnnotation shape:

  • typeAnnotation:FlowType(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


numberLiteralTypeAnnotation​

JavaScript
t.numberLiteralTypeAnnotation(value);

另见 t.isNumberLiteralTypeAnnotation(node, opts) 和 t.assertNumberLiteralTypeAnnotation(node, opts)。

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

AST 节点 NumberLiteralTypeAnnotation 的形状:

🌐 AST Node NumberLiteralTypeAnnotation shape:

  • value:number(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


numberTypeAnnotation​

JavaScript
t.numberTypeAnnotation();

另见 t.isNumberTypeAnnotation(node, opts) 和 t.assertNumberTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


numericLiteral​

JavaScript
t.numericLiteral(value);

另见 t.isNumericLiteral(node, opts) 和 t.assertNumericLiteral(node, opts)。

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

AST 节点 NumericLiteral 的形状:

🌐 AST Node NumericLiteral shape:

  • value:一个非负有限的 number(必填)

别名: Standardized, Expression, Pureish, Literal, Immutable

🌐 Aliases: Standardized, Expression, Pureish, Literal, Immutable


objectExpression​

JavaScript
t.objectExpression(properties);

另见 t.isObjectExpression(node, opts) 和 t.assertObjectExpression(node, opts)。

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

AST 节点 ObjectExpression 的形状:

🌐 AST Node ObjectExpression shape:

  • properties:(ObjectMethod | ObjectProperty | SpreadElement)[](必填)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


objectMethod​

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

另见 t.isObjectMethod(node, opts) 和 t.assertObjectMethod(node, opts)。

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

AST 节点 ObjectMethod 的形状:

🌐 AST Node ObjectMethod shape:

  • kind:"method" | "get" | "set"(默认:'method')
  • key:如果已计算则 Expression,否则 Identifier | Literal(必填)
  • params:FunctionParameter[](必填)
  • body:BlockStatement(必填)
  • computed:boolean(默认:false)
  • generator:boolean(默认:false)
  • async:boolean(默认:false)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • returnType:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)
  • typeParameters:TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认:null,从构建函数中排除)

别名: Standardized, UserWhitespacable, Function, Scopable, BlockParent, FunctionParent, Method, ObjectMember

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


objectPattern​

JavaScript
t.objectPattern(properties);

另见 t.isObjectPattern(node, opts) 和 t.assertObjectPattern(node, opts)。

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

AST 节点 ObjectPattern 的形状:

🌐 AST Node ObjectPattern shape:

  • properties:(RestElement | ObjectProperty)[](必填)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)

别名: Standardized, FunctionParameter, Pattern, PatternLike, LVal

🌐 Aliases: Standardized, FunctionParameter, Pattern, PatternLike, LVal


objectProperty​

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

另见 t.isObjectProperty(node, opts) 和 t.assertObjectProperty(node, opts)。

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

AST 节点 ObjectProperty 的形状:

🌐 AST Node ObjectProperty shape:

  • key:如果已计算则 Expression,否则 Identifier | Literal(必填)
  • value:Expression | PatternLike(必填)
  • computed:boolean(默认:false)
  • shorthand:boolean(默认:false)
  • decorators:Decorator[](默认:null)

别名:Standardized, UserWhitespacable, Property, ObjectMember

🌐 Aliases: Standardized, UserWhitespacable, Property, ObjectMember


objectTypeAnnotation​

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

另见 t.isObjectTypeAnnotation(node, opts) 和 t.assertObjectTypeAnnotation(node, opts)。

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

AST 节点 ObjectTypeAnnotation 的形状:

🌐 AST Node ObjectTypeAnnotation shape:

  • properties:(ObjectTypeProperty | ObjectTypeSpreadProperty)[](必填)
  • indexers:ObjectTypeIndexer[](默认:[])
  • callProperties:ObjectTypeCallProperty[](默认:[])
  • internalSlots:ObjectTypeInternalSlot[](默认:[])
  • exact:boolean(默认:false)
  • inexact:boolean(默认:null,从构建函数中排除)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


objectTypeCallProperty​

JavaScript
t.objectTypeCallProperty(value);

另见 t.isObjectTypeCallProperty(node, opts) 和 t.assertObjectTypeCallProperty(node, opts)。

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

AST 节点 ObjectTypeCallProperty 的形状:

🌐 AST Node ObjectTypeCallProperty shape:

  • value:FlowType(必填)
  • static:boolean(必填)

别名:Flow, UserWhitespacable

🌐 Aliases: Flow, UserWhitespacable


objectTypeIndexer​

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

另见 t.isObjectTypeIndexer(node, opts) 和 t.assertObjectTypeIndexer(node, opts)。

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

AST 节点 ObjectTypeIndexer 的形状:

🌐 AST Node ObjectTypeIndexer shape:

  • id:Identifier(默认:null)
  • key:FlowType(必填)
  • value:FlowType(必填)
  • variance:Variance(默认:null)
  • static:boolean(必填)

别名:Flow, UserWhitespacable

🌐 Aliases: Flow, UserWhitespacable


objectTypeInternalSlot​

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

另见 t.isObjectTypeInternalSlot(node, opts) 和 t.assertObjectTypeInternalSlot(node, opts)。

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

AST 节点 ObjectTypeInternalSlot 的形状:

🌐 AST Node ObjectTypeInternalSlot shape:

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

别名:Flow, UserWhitespacable

🌐 Aliases: Flow, UserWhitespacable


objectTypeProperty​

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

另见 t.isObjectTypeProperty(node, opts) 和 t.assertObjectTypeProperty(node, opts)。

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

AST 节点 ObjectTypeProperty 的形状:

🌐 AST Node ObjectTypeProperty shape:

  • key:Identifier | StringLiteral(必填)
  • value:FlowType(必填)
  • variance:Variance(默认:null)
  • kind:"init" | "get" | "set"(必填)
  • method:boolean(必填)
  • optional:boolean(必填)
  • proto:boolean(必填)
  • static:boolean(必填)

别名:Flow, UserWhitespacable

🌐 Aliases: Flow, UserWhitespacable


objectTypeSpreadProperty​

JavaScript
t.objectTypeSpreadProperty(argument);

另见 t.isObjectTypeSpreadProperty(node, opts) 和 t.assertObjectTypeSpreadProperty(node, opts)。

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

AST 节点 ObjectTypeSpreadProperty 的形状:

🌐 AST Node ObjectTypeSpreadProperty shape:

  • argument:FlowType(必填)

别名:Flow, UserWhitespacable

🌐 Aliases: Flow, UserWhitespacable


opaqueType​

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

另见 t.isOpaqueType(node, opts) 和 t.assertOpaqueType(node, opts)。

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

AST 节点 OpaqueType 的形状:

🌐 AST Node OpaqueType shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterDeclaration(默认:null)
  • supertype:FlowType(默认:null)
  • impltype:FlowType(必填)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


optionalCallExpression​

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

另见 t.isOptionalCallExpression(node, opts) 和 t.assertOptionalCallExpression(node, opts)。

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

AST 节点 OptionalCallExpression 的形状:

🌐 AST Node OptionalCallExpression shape:

  • callee:Expression(必填)
  • arguments:(Expression | SpreadElement | ArgumentPlaceholder)[](必填)
  • optional:boolean(必填)
  • typeArguments:TypeParameterInstantiation(默认:null,从构建函数中排除)
  • typeParameters:TSTypeParameterInstantiation(默认:null,从构建函数中排除)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


optionalIndexedAccessType​

JavaScript
t.optionalIndexedAccessType(objectType, indexType);

另见 t.isOptionalIndexedAccessType(node, opts) 和 t.assertOptionalIndexedAccessType(node, opts)。

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

AST 节点 OptionalIndexedAccessType 的形状:

🌐 AST Node OptionalIndexedAccessType shape:

  • objectType:FlowType(必填)
  • indexType:FlowType(必填)
  • optional:boolean(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


optionalMemberExpression​

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

另见 t.isOptionalMemberExpression(node, opts) 和 t.assertOptionalMemberExpression(node, opts)。

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

AST 节点 OptionalMemberExpression 的形状:

🌐 AST Node OptionalMemberExpression shape:

  • object:Expression(必填)
  • property:Expression | Identifier(必填)
  • computed:boolean(默认:false)
  • optional:boolean(必填)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


parenthesizedExpression​

JavaScript
t.parenthesizedExpression(expression);

另见 t.isParenthesizedExpression(node, opts) 和 t.assertParenthesizedExpression(node, opts)。

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

AST 节点 ParenthesizedExpression 的形状:

🌐 AST Node ParenthesizedExpression shape:

  • expression:Expression(必填)

别名: Standardized, Expression, ExpressionWrapper

🌐 Aliases: Standardized, Expression, ExpressionWrapper


pipelineBareFunction​

JavaScript
t.pipelineBareFunction(callee);

另见 t.isPipelineBareFunction(node, opts) 和 t.assertPipelineBareFunction(node, opts)。

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

AST 节点 PipelineBareFunction 的形状:

🌐 AST Node PipelineBareFunction shape:

  • callee:Expression(必填)

别名: Expression

🌐 Aliases: Expression


pipelinePrimaryTopicReference​

JavaScript
t.pipelinePrimaryTopicReference();

另见 t.isPipelinePrimaryTopicReference(node, opts) 和 t.assertPipelinePrimaryTopicReference(node, opts)。

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

别名: Expression

🌐 Aliases: Expression


pipelineTopicExpression​

JavaScript
t.pipelineTopicExpression(expression);

另见 t.isPipelineTopicExpression(node, opts) 和 t.assertPipelineTopicExpression(node, opts)。

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

AST 节点 PipelineTopicExpression 的形状:

🌐 AST Node PipelineTopicExpression shape:

  • expression:Expression(必填)

别名: Expression

🌐 Aliases: Expression


placeholder​

JavaScript
t.placeholder(expectedNode, name);

另见 t.isPlaceholder(node, opts) 和 t.assertPlaceholder(node, opts)。

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

AST 节点 Placeholder 的形状:

🌐 AST Node Placeholder shape:

  • expectedNode:"Identifier" | "StringLiteral" | "Expression" | "Statement" | "Declaration" | "BlockStatement" | "ClassBody" | "Pattern"(必填)
  • name:Identifier(必填)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)

别名: Miscellaneous

🌐 Aliases: Miscellaneous


privateName​

JavaScript
t.privateName(id);

另见 t.isPrivateName(node, opts) 和 t.assertPrivateName(node, opts)。

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

AST 节点 PrivateName 的形状:

🌐 AST Node PrivateName shape:

  • id:Identifier(必填)

别名:Standardized,Private

🌐 Aliases: Standardized, Private


program​

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

另见 t.isProgram(node, opts) 和 t.assertProgram(node, opts)。

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

AST 节点 Program 的形状:

🌐 AST Node Program shape:

  • body:Statement[](必填)
  • directives:Directive[](默认:[])
  • sourceType:"script" | "module"(默认:'script')
  • interpreter:InterpreterDirective(默认:null)

别名: Standardized, Scopable, BlockParent, Block

🌐 Aliases: Standardized, Scopable, BlockParent, Block


qualifiedTypeIdentifier​

JavaScript
t.qualifiedTypeIdentifier(id, qualification);

另见 t.isQualifiedTypeIdentifier(node, opts) 和 t.assertQualifiedTypeIdentifier(node, opts)。

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

AST 节点 QualifiedTypeIdentifier 的形状:

🌐 AST Node QualifiedTypeIdentifier shape:

  • id:Identifier(必填)
  • qualification:Identifier | QualifiedTypeIdentifier(必填)

别名: Flow

🌐 Aliases: Flow


recordExpression​

JavaScript
t.recordExpression(properties);

另见 t.isRecordExpression(node, opts) 和 t.assertRecordExpression(node, opts)。

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

AST 节点 RecordExpression 的形状:

🌐 AST Node RecordExpression shape:

  • properties:(ObjectProperty | SpreadElement)[](必填)

别名: Expression

🌐 Aliases: Expression


regExpLiteral​

JavaScript
t.regExpLiteral(pattern, flags);

另见 t.isRegExpLiteral(node, opts) 和 t.assertRegExpLiteral(node, opts)。

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

AST 节点 RegExpLiteral 的形状:

🌐 AST Node RegExpLiteral shape:

  • pattern:string(必填)
  • flags:string(默认:'')

别名:Standardized, Expression, Pureish, Literal

🌐 Aliases: Standardized, Expression, Pureish, Literal


restElement​

JavaScript
t.restElement(argument);

另见 t.isRestElement(node, opts) 和 t.assertRestElement(node, opts)。

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

AST 节点 RestElement 的形状:

🌐 AST Node RestElement shape:

  • argument:Identifier | ArrayPattern | ObjectPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | RestElement | AssignmentPattern(必填)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • typeAnnotation:TypeAnnotation | TSTypeAnnotation | Noop(默认:null,从构建函数中排除)

别名: Standardized, FunctionParameter, PatternLike, LVal

🌐 Aliases: Standardized, FunctionParameter, PatternLike, LVal


returnStatement​

JavaScript
t.returnStatement(argument);

另见 t.isReturnStatement(node, opts) 和 t.assertReturnStatement(node, opts)。

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

AST 节点 ReturnStatement 的形状:

🌐 AST Node ReturnStatement shape:

  • argument:Expression(默认:null)

别名: Standardized, Statement, Terminatorless, CompletionStatement

🌐 Aliases: Standardized, Statement, Terminatorless, CompletionStatement


sequenceExpression​

JavaScript
t.sequenceExpression(expressions);

另见 t.isSequenceExpression(node, opts) 和 t.assertSequenceExpression(node, opts)。

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

AST 节点 SequenceExpression 的形状:

🌐 AST Node SequenceExpression shape:

  • expressions:Expression[](必填)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


spreadElement​

JavaScript
t.spreadElement(argument);

另见 t.isSpreadElement(node, opts) 和 t.assertSpreadElement(node, opts)。

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

AST 节点 SpreadElement 的形状:

🌐 AST Node SpreadElement shape:

  • argument:Expression(必填)

别名:Standardized,UnaryLike

🌐 Aliases: Standardized, UnaryLike


staticBlock​

JavaScript
t.staticBlock(body);

另见 t.isStaticBlock(node, opts) 和 t.assertStaticBlock(node, opts)。

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

AST 节点 StaticBlock 的形状:

🌐 AST Node StaticBlock shape:

  • body:Statement[](必填)

别名: Standardized, Scopable, BlockParent, FunctionParent

🌐 Aliases: Standardized, Scopable, BlockParent, FunctionParent


stringLiteral​

JavaScript
t.stringLiteral(value);

另见 t.isStringLiteral(node, opts) 和 t.assertStringLiteral(node, opts)。

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

AST 节点 StringLiteral 的形状:

🌐 AST Node StringLiteral shape:

  • value:string(必填)

别名: Standardized, Expression, Pureish, Literal, Immutable

🌐 Aliases: Standardized, Expression, Pureish, Literal, Immutable


stringLiteralTypeAnnotation​

JavaScript
t.stringLiteralTypeAnnotation(value);

另见 t.isStringLiteralTypeAnnotation(node, opts) 和 t.assertStringLiteralTypeAnnotation(node, opts)。

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

AST 节点 StringLiteralTypeAnnotation 的形状:

🌐 AST Node StringLiteralTypeAnnotation shape:

  • value:string(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


stringTypeAnnotation​

JavaScript
t.stringTypeAnnotation();

另见 t.isStringTypeAnnotation(node, opts) 和 t.assertStringTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


super​

JavaScript
t.super();

另见 t.isSuper(node, opts) 和 t.assertSuper(node, opts)。

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

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


switchCase​

JavaScript
t.switchCase(test, consequent);

另见 t.isSwitchCase(node, opts) 和 t.assertSwitchCase(node, opts)。

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

AST 节点 SwitchCase 的形状:

🌐 AST Node SwitchCase shape:

  • test:Expression(默认:null)
  • consequent:Statement[](必填)

别名: Standardized

🌐 Aliases: Standardized


switchStatement​

JavaScript
t.switchStatement(discriminant, cases);

另见 t.isSwitchStatement(node, opts) 和 t.assertSwitchStatement(node, opts)。

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

AST 节点 SwitchStatement 的形状:

🌐 AST Node SwitchStatement shape:

  • discriminant:Expression(必填)
  • cases:SwitchCase[](必填)

别名: Standardized, Statement, BlockParent, Scopable

🌐 Aliases: Standardized, Statement, BlockParent, Scopable


symbolTypeAnnotation​

JavaScript
t.symbolTypeAnnotation();

另见 t.isSymbolTypeAnnotation(node, opts) 和 t.assertSymbolTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


tsAnyKeyword​

JavaScript
t.tsAnyKeyword();

另见 t.isTSAnyKeyword(node, opts) 和 t.assertTSAnyKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsArrayType​

JavaScript
t.tsArrayType(elementType);

另见 t.isTSArrayType(node, opts) 和 t.assertTSArrayType(node, opts)。

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

AST 节点 TSArrayType 的形状:

🌐 AST Node TSArrayType shape:

  • elementType:TSType(必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsAsExpression​

JavaScript
t.tsAsExpression(expression, typeAnnotation);

另见 t.isTSAsExpression(node, opts) 和 t.assertTSAsExpression(node, opts)。

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

AST 节点 TSAsExpression 的形状:

🌐 AST Node TSAsExpression shape:

  • expression:Expression(必填)
  • typeAnnotation:TSType(必填)

别名:TypeScript, Expression, LVal, PatternLike

🌐 Aliases: TypeScript, Expression, LVal, PatternLike


tsBigIntKeyword​

JavaScript
t.tsBigIntKeyword();

另见 t.isTSBigIntKeyword(node, opts) 和 t.assertTSBigIntKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsBooleanKeyword​

JavaScript
t.tsBooleanKeyword();

另见 t.isTSBooleanKeyword(node, opts) 和 t.assertTSBooleanKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsCallSignatureDeclaration​

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

另见 t.isTSCallSignatureDeclaration(node, opts) 和 t.assertTSCallSignatureDeclaration(node, opts)。

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

AST 节点 TSCallSignatureDeclaration 的形状:

🌐 AST Node TSCallSignatureDeclaration shape:

  • typeParameters:TSTypeParameterDeclaration(默认:null)
  • parameters:(ArrayPattern | Identifier | ObjectPattern | RestElement)[](必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)

别名:TypeScript,TSTypeElement

🌐 Aliases: TypeScript, TSTypeElement


tsConditionalType​

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

另见 t.isTSConditionalType(node, opts) 和 t.assertTSConditionalType(node, opts)。

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

AST 节点 TSConditionalType 的形状:

🌐 AST Node TSConditionalType shape:

  • checkType:TSType(必填)
  • extendsType:TSType(必填)
  • trueType:TSType(必填)
  • falseType:TSType(必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsConstructSignatureDeclaration​

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

另见 t.isTSConstructSignatureDeclaration(node, opts) 和 t.assertTSConstructSignatureDeclaration(node, opts)。

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

AST 节点 TSConstructSignatureDeclaration 的形状:

🌐 AST Node TSConstructSignatureDeclaration shape:

  • typeParameters:TSTypeParameterDeclaration(默认:null)
  • parameters:(ArrayPattern | Identifier | ObjectPattern | RestElement)[](必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)

别名:TypeScript,TSTypeElement

🌐 Aliases: TypeScript, TSTypeElement


tsConstructorType​

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

另见 t.isTSConstructorType(node, opts) 和 t.assertTSConstructorType(node, opts)。

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

AST 节点 TSConstructorType 的形状:

🌐 AST Node TSConstructorType shape:

  • typeParameters:TSTypeParameterDeclaration(默认:null)
  • parameters:(ArrayPattern | Identifier | ObjectPattern | RestElement)[](必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)
  • abstract:boolean(默认:null,从构建函数中排除)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsDeclareFunction​

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

另见 t.isTSDeclareFunction(node, opts) 和 t.assertTSDeclareFunction(node, opts)。

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

AST 节点 TSDeclareFunction 的形状:

🌐 AST Node TSDeclareFunction shape:

  • id:Identifier(默认:null)
  • typeParameters:TSTypeParameterDeclaration | Noop(默认:null)
  • params:FunctionParameter[](必填)
  • returnType:TSTypeAnnotation | Noop(默认:null)
  • async:boolean(默认:false,从构建函数中排除)
  • declare:boolean(默认:null,从构建函数中排除)
  • generator:boolean(默认:false,从构建函数中排除)

别名: TypeScript, Statement, Declaration

🌐 Aliases: TypeScript, Statement, Declaration


tsDeclareMethod​

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

另见 t.isTSDeclareMethod(node, opts) 和 t.assertTSDeclareMethod(node, opts)。

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

AST 节点 TSDeclareMethod 的形状:

🌐 AST Node TSDeclareMethod shape:

  • decorators:Decorator[](默认:null)
  • key:Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression(必填)
  • typeParameters:TSTypeParameterDeclaration | Noop(默认:null)
  • params:(FunctionParameter | TSParameterProperty)[](必填)
  • returnType:TSTypeAnnotation | Noop(默认:null)
  • abstract:boolean(默认:null,从构建函数中排除)
  • access:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • accessibility:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • async:boolean(默认:false,从构建函数中排除)
  • computed:boolean(默认:false,从构建函数中排除)
  • generator:boolean(默认:false,从构建函数中排除)
  • kind:"get" | "set" | "method" | "constructor"(默认:'method',从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • override:boolean(默认:false,从构建函数中排除)
  • static:boolean(默认:false,从构建函数中排除)

别名: TypeScript

🌐 Aliases: TypeScript


tsEnumBody​

JavaScript
t.tsEnumBody(members);

另见 t.isTSEnumBody(node, opts) 和 t.assertTSEnumBody(node, opts)。

🌐 See also t.isTSEnumBody(node, opts) and t.assertTSEnumBody(node, opts).

AST 节点 TSEnumBody 的形状:

🌐 AST Node TSEnumBody shape:

  • members:TSEnumMember[](必填)

别名: TypeScript

🌐 Aliases: TypeScript


tsEnumDeclaration​

JavaScript
t.tsEnumDeclaration(id, members);

另见 t.isTSEnumDeclaration(node, opts) 和 t.assertTSEnumDeclaration(node, opts)。

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

AST 节点 TSEnumDeclaration 的形状:

🌐 AST Node TSEnumDeclaration shape:

  • id:Identifier(必填)
  • members:TSEnumMember[](必填)
  • body:TSEnumBody(默认:null,从构建函数中排除)
  • const:boolean(默认:null,从构建函数中排除)
  • declare:boolean(默认:null,从构建函数中排除)
  • initializer:Expression(默认:null,从构建函数中排除)

别名: TypeScript, Statement, Declaration

🌐 Aliases: TypeScript, Statement, Declaration


tsEnumMember​

JavaScript
t.tsEnumMember(id, initializer);

另见 t.isTSEnumMember(node, opts) 和 t.assertTSEnumMember(node, opts)。

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

AST 节点 TSEnumMember 的形状:

🌐 AST Node TSEnumMember shape:

  • id:Identifier | StringLiteral(必填)
  • initializer:Expression(默认:null)

别名: TypeScript

🌐 Aliases: TypeScript


tsExportAssignment​

JavaScript
t.tsExportAssignment(expression);

另见 t.isTSExportAssignment(node, opts) 和 t.assertTSExportAssignment(node, opts)。

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

AST 节点 TSExportAssignment 的形状:

🌐 AST Node TSExportAssignment shape:

  • expression:Expression(必填)

别名:TypeScript,Statement

🌐 Aliases: TypeScript, Statement


tsExpressionWithTypeArguments​

JavaScript
t.tsExpressionWithTypeArguments(expression, typeParameters);

另见 t.isTSExpressionWithTypeArguments(node, opts) 和 t.assertTSExpressionWithTypeArguments(node, opts)。

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

AST 节点 TSExpressionWithTypeArguments 的形状:

🌐 AST Node TSExpressionWithTypeArguments shape:

  • expression:TSEntityName(必填)
  • typeParameters:TSTypeParameterInstantiation(默认:null)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsExternalModuleReference​

JavaScript
t.tsExternalModuleReference(expression);

另见 t.isTSExternalModuleReference(node, opts) 和 t.assertTSExternalModuleReference(node, opts)。

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

AST 节点 TSExternalModuleReference 的形状:

🌐 AST Node TSExternalModuleReference shape:

  • expression:StringLiteral(必填)

别名: TypeScript

🌐 Aliases: TypeScript


tsFunctionType​

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

另见 t.isTSFunctionType(node, opts) 和 t.assertTSFunctionType(node, opts)。

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

AST 节点 TSFunctionType 的形状:

🌐 AST Node TSFunctionType shape:

  • typeParameters:TSTypeParameterDeclaration(默认:null)
  • parameters:(ArrayPattern | Identifier | ObjectPattern | RestElement)[](必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsImportEqualsDeclaration​

JavaScript
t.tsImportEqualsDeclaration(id, moduleReference);

另见 t.isTSImportEqualsDeclaration(node, opts) 和 t.assertTSImportEqualsDeclaration(node, opts)。

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

AST 节点 TSImportEqualsDeclaration 的形状:

🌐 AST Node TSImportEqualsDeclaration shape:

  • id:Identifier(必填)
  • moduleReference:TSEntityName | TSExternalModuleReference(必填)
  • importKind:"type" | "value"(默认:null,从构建函数中排除)
  • isExport:boolean(必填)

别名: TypeScript, Statement, Declaration

🌐 Aliases: TypeScript, Statement, Declaration


tsImportType​

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

另见 t.isTSImportType(node, opts) 和 t.assertTSImportType(node, opts)。

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

AST 节点 TSImportType 的形状:

🌐 AST Node TSImportType shape:

  • argument:StringLiteral(必填)
  • qualifier:TSEntityName(默认:null)
  • typeParameters:TSTypeParameterInstantiation(默认:null)
  • options:ObjectExpression(默认:null,从构建函数中排除)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsIndexSignature​

JavaScript
t.tsIndexSignature(parameters, typeAnnotation);

另见 t.isTSIndexSignature(node, opts) 和 t.assertTSIndexSignature(node, opts)。

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

AST 节点 TSIndexSignature 的形状:

🌐 AST Node TSIndexSignature shape:

  • parameters:Identifier[](必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)
  • readonly:boolean(默认:null,从构建函数中排除)
  • static:boolean(默认:null,从构建函数中排除)

别名:TypeScript,TSTypeElement

🌐 Aliases: TypeScript, TSTypeElement


tsIndexedAccessType​

JavaScript
t.tsIndexedAccessType(objectType, indexType);

另见 t.isTSIndexedAccessType(node, opts) 和 t.assertTSIndexedAccessType(node, opts)。

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

AST 节点 TSIndexedAccessType 的形状:

🌐 AST Node TSIndexedAccessType shape:

  • objectType:TSType(必填)
  • indexType:TSType(必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsInferType​

JavaScript
t.tsInferType(typeParameter);

另见 t.isTSInferType(node, opts) 和 t.assertTSInferType(node, opts)。

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

AST 节点 TSInferType 的形状:

🌐 AST Node TSInferType shape:

  • typeParameter:TSTypeParameter(必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsInstantiationExpression​

JavaScript
t.tsInstantiationExpression(expression, typeParameters);

另见 t.isTSInstantiationExpression(node, opts) 和 t.assertTSInstantiationExpression(node, opts)。

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

AST 节点 TSInstantiationExpression 的形状:

🌐 AST Node TSInstantiationExpression shape:

  • expression:Expression(必填)
  • typeParameters:TSTypeParameterInstantiation(默认:null)

别名:TypeScript,Expression

🌐 Aliases: TypeScript, Expression


tsInterfaceBody​

JavaScript
t.tsInterfaceBody(body);

另见 t.isTSInterfaceBody(node, opts) 和 t.assertTSInterfaceBody(node, opts)。

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

AST 节点 TSInterfaceBody 的形状:

🌐 AST Node TSInterfaceBody shape:

  • body:TSTypeElement[](必填)

别名: TypeScript

🌐 Aliases: TypeScript


tsInterfaceDeclaration​

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

另见 t.isTSInterfaceDeclaration(node, opts) 和 t.assertTSInterfaceDeclaration(node, opts)。

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

AST 节点 TSInterfaceDeclaration 的形状:

🌐 AST Node TSInterfaceDeclaration shape:

  • id:Identifier(必填)
  • typeParameters:TSTypeParameterDeclaration(默认:null)
  • extends:TSExpressionWithTypeArguments[](默认:null)
  • body:TSInterfaceBody(必填)
  • declare:boolean(默认:null,从构建函数中排除)

别名: TypeScript, Statement, Declaration

🌐 Aliases: TypeScript, Statement, Declaration


tsIntersectionType​

JavaScript
t.tsIntersectionType(types);

另见 t.isTSIntersectionType(node, opts) 和 t.assertTSIntersectionType(node, opts)。

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

AST 节点 TSIntersectionType 的形状:

🌐 AST Node TSIntersectionType shape:

  • types:TSType[](必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsIntrinsicKeyword​

JavaScript
t.tsIntrinsicKeyword();

另见 t.isTSIntrinsicKeyword(node, opts) 和 t.assertTSIntrinsicKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsLiteralType​

JavaScript
t.tsLiteralType(literal);

另见 t.isTSLiteralType(node, opts) 和 t.assertTSLiteralType(node, opts)。

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

AST 节点 TSLiteralType 的形状:

🌐 AST Node TSLiteralType shape:

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsMappedType​

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

另见 t.isTSMappedType(node, opts) 和 t.assertTSMappedType(node, opts)。

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

AST 节点 TSMappedType 的形状:

🌐 AST Node TSMappedType shape:

  • typeParameter:TSTypeParameter(必填)
  • typeAnnotation:TSType(默认:null)
  • nameType:TSType(默认:null)
  • optional:true | false | "+" | "-"(默认:null,从构建函数中排除)
  • readonly:true | false | "+" | "-"(默认:null,从构建函数中排除)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsMethodSignature​

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

另见 t.isTSMethodSignature(node, opts) 和 t.assertTSMethodSignature(node, opts)。

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

AST 节点 TSMethodSignature 的形状:

🌐 AST Node TSMethodSignature shape:

  • key:Expression(必填)
  • typeParameters:TSTypeParameterDeclaration(默认:null)
  • parameters:(ArrayPattern | Identifier | ObjectPattern | RestElement)[](必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)
  • computed:boolean(默认:false,从构建函数中排除)
  • kind:"method" | "get" | "set"(必填)
  • optional:boolean(默认:null,从构建函数中排除)

别名:TypeScript,TSTypeElement

🌐 Aliases: TypeScript, TSTypeElement


tsModuleBlock​

JavaScript
t.tsModuleBlock(body);

另见 t.isTSModuleBlock(node, opts) 和 t.assertTSModuleBlock(node, opts)。

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

AST 节点 TSModuleBlock 的形状:

🌐 AST Node TSModuleBlock shape:

  • body:Statement[](必填)

别名: TypeScript, Scopable, Block, BlockParent, FunctionParent

🌐 Aliases: TypeScript, Scopable, Block, BlockParent, FunctionParent


tsModuleDeclaration​

JavaScript
t.tsModuleDeclaration(id, body);

另见 t.isTSModuleDeclaration(node, opts) 和 t.assertTSModuleDeclaration(node, opts)。

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

AST 节点 TSModuleDeclaration 的形状:

🌐 AST Node TSModuleDeclaration shape:

  • id:Identifier | StringLiteral(必填)
  • body:TSModuleBlock | TSModuleDeclaration(必填)
  • declare:boolean(默认:null,从构建函数中排除)
  • global:boolean(默认:null,从构建函数中排除)
  • kind:"global" | "module" | "namespace"(必填)

别名: TypeScript, Statement, Declaration

🌐 Aliases: TypeScript, Statement, Declaration


tsNamedTupleMember​

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

另见 t.isTSNamedTupleMember(node, opts) 和 t.assertTSNamedTupleMember(node, opts)。

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

AST 节点 TSNamedTupleMember 的形状:

🌐 AST Node TSNamedTupleMember shape:

  • label:Identifier(必填)
  • elementType:TSType(必填)
  • optional:boolean(默认:false)

别名: TypeScript

🌐 Aliases: TypeScript


tsNamespaceExportDeclaration​

JavaScript
t.tsNamespaceExportDeclaration(id);

另见 t.isTSNamespaceExportDeclaration(node, opts) 和 t.assertTSNamespaceExportDeclaration(node, opts)。

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

AST 节点 TSNamespaceExportDeclaration 的形状:

🌐 AST Node TSNamespaceExportDeclaration shape:

  • id:Identifier(必填)

别名:TypeScript,Statement

🌐 Aliases: TypeScript, Statement


tsNeverKeyword​

JavaScript
t.tsNeverKeyword();

另见 t.isTSNeverKeyword(node, opts) 和 t.assertTSNeverKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsNonNullExpression​

JavaScript
t.tsNonNullExpression(expression);

另见 t.isTSNonNullExpression(node, opts) 和 t.assertTSNonNullExpression(node, opts)。

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

AST 节点 TSNonNullExpression 的形状:

🌐 AST Node TSNonNullExpression shape:

  • expression:Expression(必填)

别名:TypeScript, Expression, LVal, PatternLike

🌐 Aliases: TypeScript, Expression, LVal, PatternLike


tsNullKeyword​

JavaScript
t.tsNullKeyword();

另见 t.isTSNullKeyword(node, opts) 和 t.assertTSNullKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsNumberKeyword​

JavaScript
t.tsNumberKeyword();

另见 t.isTSNumberKeyword(node, opts) 和 t.assertTSNumberKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsObjectKeyword​

JavaScript
t.tsObjectKeyword();

另见 t.isTSObjectKeyword(node, opts) 和 t.assertTSObjectKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsOptionalType​

JavaScript
t.tsOptionalType(typeAnnotation);

另见 t.isTSOptionalType(node, opts) 和 t.assertTSOptionalType(node, opts)。

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

AST 节点 TSOptionalType 的形状:

🌐 AST Node TSOptionalType shape:

  • typeAnnotation:TSType(必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsParameterProperty​

JavaScript
t.tsParameterProperty(parameter);

另见 t.isTSParameterProperty(node, opts) 和 t.assertTSParameterProperty(node, opts)。

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

AST 节点 TSParameterProperty 的形状:

🌐 AST Node TSParameterProperty shape:

  • parameter:Identifier | AssignmentPattern(必填)
  • accessibility:"public" | "private" | "protected"(默认:null,从构建函数中排除)
  • decorators:Decorator[](默认:null,从构建函数中排除)
  • override:boolean(默认:null,从构建函数中排除)
  • readonly:boolean(默认:null,从构建函数中排除)

别名:TypeScript, LVal

🌐 Aliases: TypeScript, LVal


tsParenthesizedType​

JavaScript
t.tsParenthesizedType(typeAnnotation);

另见 t.isTSParenthesizedType(node, opts) 和 t.assertTSParenthesizedType(node, opts)。

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

AST 节点 TSParenthesizedType 的形状:

🌐 AST Node TSParenthesizedType shape:

  • typeAnnotation:TSType(必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsPropertySignature​

JavaScript
t.tsPropertySignature(key, typeAnnotation);

另见 t.isTSPropertySignature(node, opts) 和 t.assertTSPropertySignature(node, opts)。

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

AST 节点 TSPropertySignature 的形状:

🌐 AST Node TSPropertySignature shape:

  • key:Expression(必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)
  • computed:boolean(默认:false,从构建函数中排除)
  • kind:"get" | "set"(默认:null,从构建函数中排除)
  • optional:boolean(默认:null,从构建函数中排除)
  • readonly:boolean(默认:null,从构建函数中排除)

别名:TypeScript,TSTypeElement

🌐 Aliases: TypeScript, TSTypeElement


tsQualifiedName​

JavaScript
t.tsQualifiedName(left, right);

另见 t.isTSQualifiedName(node, opts) 和 t.assertTSQualifiedName(node, opts)。

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

AST 节点 TSQualifiedName 的形状:

🌐 AST Node TSQualifiedName shape:

  • left:TSEntityName(必填)
  • right:Identifier(必填)

别名:TypeScript, TSEntityName

🌐 Aliases: TypeScript, TSEntityName


tsRestType​

JavaScript
t.tsRestType(typeAnnotation);

另见 t.isTSRestType(node, opts) 和 t.assertTSRestType(node, opts)。

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

AST 节点 TSRestType 的形状:

🌐 AST Node TSRestType shape:

  • typeAnnotation:TSType(必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsSatisfiesExpression​

JavaScript
t.tsSatisfiesExpression(expression, typeAnnotation);
历史
版本变更
v7.20.0引入

另见 t.isTSSatisfiesExpression(node, opts) 和 t.assertTSSatisfiesExpression(node, opts)。

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

AST 节点 TSSatisfiesExpression 的形状:

🌐 AST Node TSSatisfiesExpression shape:

  • expression:Expression(必填)
  • typeAnnotation:TSType(必填)

别名:TypeScript, Expression, LVal, PatternLike

🌐 Aliases: TypeScript, Expression, LVal, PatternLike


tsStringKeyword​

JavaScript
t.tsStringKeyword();

另见 t.isTSStringKeyword(node, opts) 和 t.assertTSStringKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsSymbolKeyword​

JavaScript
t.tsSymbolKeyword();

另见 t.isTSSymbolKeyword(node, opts) 和 t.assertTSSymbolKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsTemplateLiteralType​

JavaScript
t.tsTemplateLiteralType(quasis, types);

另见 t.isTSTemplateLiteralType(node, opts) 和 t.assertTSTemplateLiteralType(node, opts)。

🌐 See also t.isTSTemplateLiteralType(node, opts) and t.assertTSTemplateLiteralType(node, opts).

AST 节点 TSTemplateLiteralType 的形状:

🌐 AST Node TSTemplateLiteralType shape:

  • quasis:TemplateElement[](必填)
  • types:TSType[](必填)

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsThisType​

JavaScript
t.tsThisType();

另见 t.isTSThisType(node, opts) 和 t.assertTSThisType(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsTupleType​

JavaScript
t.tsTupleType(elementTypes);

另见 t.isTSTupleType(node, opts) 和 t.assertTSTupleType(node, opts)。

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

AST 节点 TSTupleType 的形状:

🌐 AST Node TSTupleType shape:

  • elementTypes:(TSType | TSNamedTupleMember)[](必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsTypeAliasDeclaration​

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

另见 t.isTSTypeAliasDeclaration(node, opts) 和 t.assertTSTypeAliasDeclaration(node, opts)。

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

AST 节点 TSTypeAliasDeclaration 的形状:

🌐 AST Node TSTypeAliasDeclaration shape:

  • id:Identifier(必填)
  • typeParameters:TSTypeParameterDeclaration(默认:null)
  • typeAnnotation:TSType(必填)
  • declare:boolean(默认:null,从构建函数中排除)

别名: TypeScript, Statement, Declaration

🌐 Aliases: TypeScript, Statement, Declaration


tsTypeAnnotation​

JavaScript
t.tsTypeAnnotation(typeAnnotation);

另见 t.isTSTypeAnnotation(node, opts) 和 t.assertTSTypeAnnotation(node, opts)。

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

AST 节点 TSTypeAnnotation 的形状:

🌐 AST Node TSTypeAnnotation shape:

  • typeAnnotation:TSType(必填)

别名: TypeScript

🌐 Aliases: TypeScript


tsTypeAssertion​

JavaScript
t.tsTypeAssertion(typeAnnotation, expression);

另见 t.isTSTypeAssertion(node, opts) 和 t.assertTSTypeAssertion(node, opts)。

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

AST 节点 TSTypeAssertion 的形状:

🌐 AST Node TSTypeAssertion shape:

  • typeAnnotation:TSType(必填)
  • expression:Expression(必填)

别名:TypeScript, Expression, LVal, PatternLike

🌐 Aliases: TypeScript, Expression, LVal, PatternLike


tsTypeLiteral​

JavaScript
t.tsTypeLiteral(members);

另见 t.isTSTypeLiteral(node, opts) 和 t.assertTSTypeLiteral(node, opts)。

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

AST 节点 TSTypeLiteral 的形状:

🌐 AST Node TSTypeLiteral shape:

  • members:TSTypeElement[](必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsTypeOperator​

JavaScript
t.tsTypeOperator(typeAnnotation, operator);

另见 t.isTSTypeOperator(node, opts) 和 t.assertTSTypeOperator(node, opts)。

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

AST 节点 TSTypeOperator 的形状:

🌐 AST Node TSTypeOperator shape:

  • typeAnnotation:TSType(必填)
  • operator:string(默认:'keyof')

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsTypeParameter​

JavaScript
t.tsTypeParameter(constraint, default, name);
历史
版本变更
v7.21.0支持 const

另见 t.isTSTypeParameter(node, opts) 和 t.assertTSTypeParameter(node, opts)。

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

AST 节点 TSTypeParameter 的形状:

🌐 AST Node TSTypeParameter shape:

  • constraint:TSType(默认:null)
  • default:TSType(默认:null)
  • name:string(必填)
  • const:boolean(默认:null,从构建函数中排除)
  • in:boolean(默认:null,从构建函数中排除)
  • out:boolean(默认:null,从构建函数中排除)

别名: TypeScript

🌐 Aliases: TypeScript


tsTypeParameterDeclaration​

JavaScript
t.tsTypeParameterDeclaration(params);

另见 t.isTSTypeParameterDeclaration(node, opts) 和 t.assertTSTypeParameterDeclaration(node, opts)。

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

AST 节点 TSTypeParameterDeclaration 的形状:

🌐 AST Node TSTypeParameterDeclaration shape:

  • params:TSTypeParameter[](必填)

别名: TypeScript

🌐 Aliases: TypeScript


tsTypeParameterInstantiation​

JavaScript
t.tsTypeParameterInstantiation(params);

另见 t.isTSTypeParameterInstantiation(node, opts) 和 t.assertTSTypeParameterInstantiation(node, opts)。

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

AST 节点 TSTypeParameterInstantiation 的形状:

🌐 AST Node TSTypeParameterInstantiation shape:

  • params:TSType[](必填)

别名: TypeScript

🌐 Aliases: TypeScript


tsTypePredicate​

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

另见 t.isTSTypePredicate(node, opts) 和 t.assertTSTypePredicate(node, opts)。

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

AST 节点 TSTypePredicate 的形状:

🌐 AST Node TSTypePredicate shape:

  • parameterName:Identifier | TSThisType(必填)
  • typeAnnotation:TSTypeAnnotation(默认:null)
  • asserts:boolean(默认:null)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsTypeQuery​

JavaScript
t.tsTypeQuery(exprName, typeParameters);

另见 t.isTSTypeQuery(node, opts) 和 t.assertTSTypeQuery(node, opts)。

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

AST 节点 TSTypeQuery 的形状:

🌐 AST Node TSTypeQuery shape:

  • exprName:TSEntityName | TSImportType(必填)
  • typeParameters:TSTypeParameterInstantiation(默认:null)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsTypeReference​

JavaScript
t.tsTypeReference(typeName, typeParameters);

另见 t.isTSTypeReference(node, opts) 和 t.assertTSTypeReference(node, opts)。

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

AST 节点 TSTypeReference 的形状:

🌐 AST Node TSTypeReference shape:

  • typeName:TSEntityName(必填)
  • typeParameters:TSTypeParameterInstantiation(默认:null)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsUndefinedKeyword​

JavaScript
t.tsUndefinedKeyword();

另见 t.isTSUndefinedKeyword(node, opts) 和 t.assertTSUndefinedKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsUnionType​

JavaScript
t.tsUnionType(types);

另见 t.isTSUnionType(node, opts) 和 t.assertTSUnionType(node, opts)。

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

AST 节点 TSUnionType 的形状:

🌐 AST Node TSUnionType shape:

  • types:TSType[](必填)

别名:TypeScript,TSType

🌐 Aliases: TypeScript, TSType


tsUnknownKeyword​

JavaScript
t.tsUnknownKeyword();

另见 t.isTSUnknownKeyword(node, opts) 和 t.assertTSUnknownKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


tsVoidKeyword​

JavaScript
t.tsVoidKeyword();

另见 t.isTSVoidKeyword(node, opts) 和 t.assertTSVoidKeyword(node, opts)。

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

别名:TypeScript, TSType, TSBaseType

🌐 Aliases: TypeScript, TSType, TSBaseType


taggedTemplateExpression​

JavaScript
t.taggedTemplateExpression(tag, quasi);

另见 t.isTaggedTemplateExpression(node, opts) 和 t.assertTaggedTemplateExpression(node, opts)。

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

AST 节点 TaggedTemplateExpression 的形状:

🌐 AST Node TaggedTemplateExpression shape:

  • tag:Expression(必填)
  • quasi:TemplateLiteral(必填)
  • typeParameters:TypeParameterInstantiation | TSTypeParameterInstantiation(默认:null,从构建函数中排除)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


templateElement​

JavaScript
t.templateElement(value, tail);

另见 t.isTemplateElement(node, opts) 和 t.assertTemplateElement(node, opts)。

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

AST 节点 TemplateElement 的形状:

🌐 AST Node TemplateElement shape:

  • value:{ raw: string, cooked?: string }(必填)
  • tail:boolean(默认:false)

别名: Standardized

🌐 Aliases: Standardized


templateLiteral​

JavaScript
t.templateLiteral(quasis, expressions);

另见 t.isTemplateLiteral(node, opts) 和 t.assertTemplateLiteral(node, opts)。

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

AST 节点 TemplateLiteral 的形状:

🌐 AST Node TemplateLiteral shape:

  • quasis:TemplateElement[](必填)
  • expressions:(Expression | TSType)[](必填)

别名: Standardized, Expression, Literal

🌐 Aliases: Standardized, Expression, Literal


thisExpression​

JavaScript
t.thisExpression();

另见 t.isThisExpression(node, opts) 和 t.assertThisExpression(node, opts)。

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

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


thisTypeAnnotation​

JavaScript
t.thisTypeAnnotation();

另见 t.isThisTypeAnnotation(node, opts) 和 t.assertThisTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


throwStatement​

JavaScript
t.throwStatement(argument);

另见 t.isThrowStatement(node, opts) 和 t.assertThrowStatement(node, opts)。

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

AST 节点 ThrowStatement 的形状:

🌐 AST Node ThrowStatement shape:

  • argument:Expression(必填)

别名: Standardized, Statement, Terminatorless, CompletionStatement

🌐 Aliases: Standardized, Statement, Terminatorless, CompletionStatement


topicReference​

JavaScript
t.topicReference();

另见 t.isTopicReference(node, opts) 和 t.assertTopicReference(node, opts)。

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

别名: Expression

🌐 Aliases: Expression


tryStatement​

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

另见 t.isTryStatement(node, opts) 和 t.assertTryStatement(node, opts)。

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

AST 节点 TryStatement 的形状:

🌐 AST Node TryStatement shape:

  • block:BlockStatement(必填)
  • handler:CatchClause(默认:null)
  • finalizer:BlockStatement(默认:null)

别名:Standardized,Statement

🌐 Aliases: Standardized, Statement


tupleExpression​

JavaScript
t.tupleExpression(elements);

另见 t.isTupleExpression(node, opts) 和 t.assertTupleExpression(node, opts)。

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

AST 节点 TupleExpression 的形状:

🌐 AST Node TupleExpression shape:

  • elements:(Expression | SpreadElement)[](默认:[])

别名: Expression

🌐 Aliases: Expression


tupleTypeAnnotation​

JavaScript
t.tupleTypeAnnotation(types);

另见 t.isTupleTypeAnnotation(node, opts) 和 t.assertTupleTypeAnnotation(node, opts)。

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

AST 节点 TupleTypeAnnotation 的形状:

🌐 AST Node TupleTypeAnnotation shape:

  • types:FlowType[](必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


typeAlias​

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

另见 t.isTypeAlias(node, opts) 和 t.assertTypeAlias(node, opts)。

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

AST 节点 TypeAlias 的形状:

🌐 AST Node TypeAlias shape:

  • id:Identifier(必填)
  • typeParameters:TypeParameterDeclaration(默认:null)
  • right:FlowType(必填)

别名: Flow, FlowDeclaration, Statement, Declaration

🌐 Aliases: Flow, FlowDeclaration, Statement, Declaration


typeAnnotation​

JavaScript
t.typeAnnotation(typeAnnotation);

另见 t.isTypeAnnotation(node, opts) 和 t.assertTypeAnnotation(node, opts)。

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

AST 节点 TypeAnnotation 的形状:

🌐 AST Node TypeAnnotation shape:

  • typeAnnotation:FlowType(必填)

别名: Flow

🌐 Aliases: Flow


typeCastExpression​

JavaScript
t.typeCastExpression(expression, typeAnnotation);

另见 t.isTypeCastExpression(node, opts) 和 t.assertTypeCastExpression(node, opts)。

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

AST 节点 TypeCastExpression 的形状:

🌐 AST Node TypeCastExpression shape:

  • expression:Expression(必填)
  • typeAnnotation:TypeAnnotation(必填)

别名: Flow, ExpressionWrapper, Expression

🌐 Aliases: Flow, ExpressionWrapper, Expression


typeParameter​

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

另见 t.isTypeParameter(node, opts) 和 t.assertTypeParameter(node, opts)。

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

AST 节点 TypeParameter 的形状:

🌐 AST Node TypeParameter shape:

  • bound:TypeAnnotation(默认:null)
  • default:FlowType(默认:null)
  • variance:Variance(默认:null)
  • name:string(必填)

别名: Flow

🌐 Aliases: Flow


typeParameterDeclaration​

JavaScript
t.typeParameterDeclaration(params);

另见 t.isTypeParameterDeclaration(node, opts) 和 t.assertTypeParameterDeclaration(node, opts)。

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

AST 节点 TypeParameterDeclaration 的形状:

🌐 AST Node TypeParameterDeclaration shape:

  • params:TypeParameter[](必填)

别名: Flow

🌐 Aliases: Flow


typeParameterInstantiation​

JavaScript
t.typeParameterInstantiation(params);

另见 t.isTypeParameterInstantiation(node, opts) 和 t.assertTypeParameterInstantiation(node, opts)。

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

AST 节点 TypeParameterInstantiation 的形状:

🌐 AST Node TypeParameterInstantiation shape:

  • params:FlowType[](必填)

别名: Flow

🌐 Aliases: Flow


typeofTypeAnnotation​

JavaScript
t.typeofTypeAnnotation(argument);

另见 t.isTypeofTypeAnnotation(node, opts) 和 t.assertTypeofTypeAnnotation(node, opts)。

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

AST 节点 TypeofTypeAnnotation 的形状:

🌐 AST Node TypeofTypeAnnotation shape:

  • argument:FlowType(必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


unaryExpression​

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

另见 t.isUnaryExpression(node, opts) 和 t.assertUnaryExpression(node, opts)。

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

AST 节点 UnaryExpression 的形状:

🌐 AST Node UnaryExpression shape:

  • operator:"void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof"(必填)
  • argument:Expression(必填)
  • prefix:boolean(默认:true)

别名: Standardized, UnaryLike, Expression

🌐 Aliases: Standardized, UnaryLike, Expression


unionTypeAnnotation​

JavaScript
t.unionTypeAnnotation(types);

另见 t.isUnionTypeAnnotation(node, opts) 和 t.assertUnionTypeAnnotation(node, opts)。

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

AST 节点 UnionTypeAnnotation 的形状:

🌐 AST Node UnionTypeAnnotation shape:

  • types:FlowType[](必填)

别名:Flow,FlowType

🌐 Aliases: Flow, FlowType


updateExpression​

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

另见 t.isUpdateExpression(node, opts) 和 t.assertUpdateExpression(node, opts)。

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

AST 节点 UpdateExpression 的形状:

🌐 AST Node UpdateExpression shape:

  • operator:"++" | "--"(必填)
  • argument:Expression(必填)
  • prefix:boolean(默认:false)

别名:Standardized,Expression

🌐 Aliases: Standardized, Expression


v8内置标识符​

🌐 v8IntrinsicIdentifier

JavaScript
t.v8IntrinsicIdentifier(name);

另见 t.isV8IntrinsicIdentifier(node, opts) 和 t.assertV8IntrinsicIdentifier(node, opts)。

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

AST 节点 V8IntrinsicIdentifier 的形状:

🌐 AST Node V8IntrinsicIdentifier shape:

  • name:string(必填)

别名: Miscellaneous

🌐 Aliases: Miscellaneous


variableDeclaration​

JavaScript
t.variableDeclaration(kind, declarations);
历史
版本变更
v7.20.0kind 可以是 “using”。
v7.22.0kind 可以是 “await using”。

另见 t.isVariableDeclaration(node, opts) 和 t.assertVariableDeclaration(node, opts)。

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

AST 节点 VariableDeclaration 的形状:

🌐 AST Node VariableDeclaration shape:

  • kind:"var" | "let" | "const" | "using" | "await using"(必填)
  • declarations:VariableDeclarator[](必填)
  • declare:boolean(默认:null,从构建函数中排除)

别名: Standardized, Statement, Declaration

🌐 Aliases: Standardized, Statement, Declaration


variableDeclarator​

JavaScript
t.variableDeclarator(id, init);

另见 t.isVariableDeclarator(node, opts) 和 t.assertVariableDeclarator(node, opts)。

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

AST 节点 VariableDeclarator 的形状:

🌐 AST Node VariableDeclarator shape:

  • id:LVal | VoidPattern(必填)
  • init:Expression(默认:null)
  • definite:boolean(默认:null,从构建函数中排除)

别名: Standardized

🌐 Aliases: Standardized


variance​

JavaScript
t.variance(kind);

另见 t.isVariance(node, opts) 和 t.assertVariance(node, opts)。

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

AST 节点 Variance 的形状:

🌐 AST Node Variance shape:

  • kind:"minus" | "plus"(必填)

别名: Flow

🌐 Aliases: Flow


voidPattern​

JavaScript
t.voidPattern();
历史
版本变更
v7.28.0引入

另见 t.isVoidPattern(node, opts) 和 t.assertVoidPattern(node, opts)。

🌐 See also t.isVoidPattern(node, opts) and t.assertVoidPattern(node, opts).

别名: Pattern, PatternLike, FunctionParameter

🌐 Aliases: Pattern, PatternLike, FunctionParameter


voidTypeAnnotation​

JavaScript
t.voidTypeAnnotation();

另见 t.isVoidTypeAnnotation(node, opts) 和 t.assertVoidTypeAnnotation(node, opts)。

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

别名: Flow, FlowType, FlowBaseAnnotation

🌐 Aliases: Flow, FlowType, FlowBaseAnnotation


whileStatement​

JavaScript
t.whileStatement(test, body);

另见 t.isWhileStatement(node, opts) 和 t.assertWhileStatement(node, opts)。

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

AST 节点 WhileStatement 的形状:

🌐 AST Node WhileStatement shape:

  • test:Expression(必填)
  • body:Statement(必填)

别名: Standardized, Statement, BlockParent, Loop, While, Scopable

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


withStatement​

JavaScript
t.withStatement(object, body);

另见 t.isWithStatement(node, opts) 和 t.assertWithStatement(node, opts)。

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

AST 节点 WithStatement 的形状:

🌐 AST Node WithStatement shape:

  • object:Expression(必填)
  • body:Statement(必填)

别名:Standardized,Statement

🌐 Aliases: Standardized, Statement


yieldExpression​

JavaScript
t.yieldExpression(argument, delegate);

另见 t.isYieldExpression(node, opts) 和 t.assertYieldExpression(node, opts)。

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

AST 节点 YieldExpression 的形状:

🌐 AST Node YieldExpression shape:

  • argument:Expression(默认:null)
  • delegate:boolean(默认:false)

别名: Standardized, Expression, Terminatorless

🌐 Aliases: Standardized, Expression, Terminatorless


别名​

🌐 Aliases

存取器​

🌐 Accessor

已弃用,将在 Babel 8 中移除。

🌐 Deprecated. Will be removed in Babel 8.

JavaScript
t.isAccessor(node);

覆盖节点:

🌐 Covered nodes:

二进制​

🌐 Binary

BinaryExpression 和 LogicalExpression 的封面,它们共享相同的 AST 形状。

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

JavaScript
t.isBinary(node);

覆盖节点:

🌐 Covered nodes:

堵塞​

🌐 Block

已弃用,将在 Babel 8 中移除。

🌐 Deprecated. Will be removed in Babel 8.

JavaScript
t.isBlock(node);

覆盖节点:

🌐 Covered nodes:

BlockParent​

一组 AST 节点,它们通过新的 LexicalEnvironment 启动执行上下文。换句话说,它们定义了 let 和 const 声明的作用域。

🌐 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
t.isBlockParent(node);

覆盖节点:

🌐 Covered nodes:

类​

🌐 Class

ClassExpression 和 ClassDeclaration 的封面,它们共享相同的 AST 形状。

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

JavaScript
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
t.isCompletionStatement(node);

覆盖节点:

🌐 Covered nodes:

有条件的​

🌐 Conditional

ConditionalExpression 和 IfStatement 的封面,它们共享相同的 AST 形状。

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

JavaScript
t.isConditional(node);

覆盖节点:

🌐 Covered nodes:

声明​

🌐 Declaration

任何声明的封面。

🌐 A cover of any Declarations.

JavaScript
t.isDeclaration(node);

覆盖节点:

🌐 Covered nodes:

EnumBody​

Flow 枚举主体的封面。

🌐 A cover of Flow enum bodies.

JavaScript
t.isEnumBody(node);

覆盖节点:

🌐 Covered nodes:

EnumMember​

Flow 枚举成员的封面。

🌐 A cover of Flow enum members.

JavaScript
t.isEnumMember(node);

覆盖节点:

🌐 Covered nodes:

ExportDeclaration​

任何导出声明的封面。

🌐 A cover of any ExportDeclarations.

JavaScript
t.isExportDeclaration(node);

覆盖节点:

🌐 Covered nodes:

表达​

🌐 Expression

任何 Expression 的封面。

🌐 A cover of any Expressions.

JavaScript
t.isExpression(node);

覆盖节点:

🌐 Covered nodes:

ExpressionWrapper​

没有运行时语义的表达式封装器。

🌐 A wrapper of expression that does not have runtime semantics.

JavaScript
t.isExpressionWrapper(node);

覆盖节点:

🌐 Covered nodes:

Flow​

为 Flow 定义的 AST 节点的覆盖。

🌐 A cover of AST nodes defined for Flow.

JavaScript
t.isFlow(node);

覆盖节点:

🌐 Covered nodes:

FlowBaseAnnotation​

主要 Flow 类型注释的封面。

🌐 A cover of primary Flow type annotations.

JavaScript
t.isFlowBaseAnnotation(node);

覆盖节点:

🌐 Covered nodes:

FlowDeclaration​

Flow 声明的封面。

🌐 A cover of Flow declarations.

JavaScript
t.isFlowDeclaration(node);

覆盖节点:

🌐 Covered nodes:

FlowPredicate​

Flow 谓词的封面。

🌐 A cover of Flow predicates.

JavaScript
t.isFlowPredicate(node);

覆盖节点:

🌐 Covered nodes:

FlowType​

Flow 类型注释的封面。

🌐 A cover of Flow type annotations.

JavaScript
t.isFlowType(node);

覆盖节点:

🌐 Covered nodes:

为了​

🌐 For

涵盖了 ForStatement 和 ForXStatement。

🌐 A cover of ForStatements and ForXStatements.

JavaScript
t.isFor(node);

覆盖节点:

🌐 Covered nodes:

ForX声明​

🌐 ForXStatement

ForInStatements 和 ForOfStatements 的一个封面。

🌐 A cover of ForInStatements and ForOfStatements.

JavaScript
t.isForXStatement(node);

覆盖节点:

🌐 Covered nodes:

函数​

🌐 Function

涵盖了函数和方法,必备的 body 和 params。注意:Function 和 FunctionParent 不同。例如,StaticBlock 是一个 FunctionParent,但不是 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
t.isFunction(node);

覆盖节点:

🌐 Covered nodes:

FunctionParameter​

函数参数的一个封装。它们是 FormalParameterList 的元素。

🌐 A cover of function parameters. They are the elements of FormalParameterList.

JavaScript
t.isFunctionParameter(node);

覆盖节点:

🌐 Covered nodes:

FunctionParent​

一组 AST 节点,用于通过新的 VariableEnvironment 启动执行上下文。换句话说,它们定义了 var 声明的作用域。自 Babel 7 起,FunctionParent 不再包含 Program。

🌐 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
t.isFunctionParent(node);

覆盖节点:

🌐 Covered nodes:

不变的​

🌐 Immutable

不可变对象和 JSX 元素的概述。如果一个对象是不可变的,那意味着创建后不能再定义其他属性。

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

JavaScript
t.isImmutable(node);

覆盖节点:

🌐 Covered nodes:

ImportOrExportDeclaration​

历史
版本变更
v7.21.0引入

ImportDeclaration 和 ExportDeclaration 的概述。

🌐 A cover of ImportDeclaration and ExportDeclaration.

JavaScript
t.isImportOrExportDeclaration(node);

覆盖节点:

🌐 Covered nodes:

JSX​

为 JSX 定义的一组 AST 节点的封装。

🌐 A cover of AST nodes defined for JSX.

JavaScript
t.isJSX(node);

覆盖节点:

🌐 Covered nodes:

左值​

🌐 LVal

left 中赋值表达式和 ForXStatement 中左侧表达式的概述。

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

JavaScript
t.isLVal(node);

覆盖节点:

🌐 Covered nodes:

字面量​

🌐 Literal

涵盖 Literal、Regular Expression Literal 和 Template Literal 的内容。

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

JavaScript
t.isLiteral(node);

覆盖节点:

🌐 Covered nodes:

环形​

🌐 Loop

循环语句的封面。

🌐 A cover of loop statements.

JavaScript
t.isLoop(node);

覆盖节点:

🌐 Covered nodes:

方法​

🌐 Method

对象方法和类方法的封面。

🌐 A cover of object methods and class methods.

JavaScript
t.isMethod(node);

覆盖节点:

🌐 Covered nodes:

各种各样的​

🌐 Miscellaneous

涵盖有时对开发有用的非标准 AST 类型。

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

JavaScript
t.isMiscellaneous(node);

覆盖节点:

🌐 Covered nodes:

ModuleDeclaration​

历史
版本变更
v7.21.0已弃用
caution

已弃用,请改用 ImportOrExportDeclaration。有关迁移说明,请查看 PR #15266。

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

JavaScript
t.isModuleDeclaration(node);

覆盖节点:

🌐 Covered nodes:

ModuleSpecifier​

关于进出口说明符的概述。注意:它 不是 规范中定义的 ModuleSpecifier。

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

JavaScript
t.isModuleSpecifier(node);

覆盖节点:

🌐 Covered nodes:

ObjectMember​

在对象字面量中覆盖 members。

🌐 A cover of members in an object literal.

JavaScript
t.isObjectMember(node);

覆盖节点:

🌐 Covered nodes:

模式​

🌐 Pattern

除了标识符外,BindingPattern 的一个封装。

🌐 A cover of BindingPattern except Identifiers.

JavaScript
t.isPattern(node);

覆盖节点:

🌐 Covered nodes:

PatternLike​

BindingPattern 的封面。

🌐 A cover of BindingPatterns.

JavaScript
t.isPatternLike(node);

覆盖节点:

🌐 Covered nodes:

私有的​

🌐 Private

私有类元素和私有标识符的封面。

🌐 A cover of private class elements and private identifiers.

JavaScript
t.isPrivate(node);

覆盖节点:

🌐 Covered nodes:

属性​

🌐 Property

对象属性和类属性的封面。

🌐 A cover of object properties and class properties.

JavaScript
t.isProperty(node);

覆盖节点:

🌐 Covered nodes:

纯粹的​

🌐 Pureish

AST 节点的封装,这些节点没有副作用。换句话说,如果它们被多次求值,行为不会有可观察的变化。

🌐 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
t.isPureish(node);

覆盖节点:

🌐 Covered nodes:

适用范围​

🌐 Scopable

FunctionParent 和 BlockParent 的封面。

🌐 A cover of FunctionParent and BlockParent.

JavaScript
t.isScopable(node);

覆盖节点:

🌐 Covered nodes:

标准化​

🌐 Standardized

AST 节点的封面,它们是官方 ECMAScript 规范的一部分。

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

JavaScript
t.isStandardized(node);

覆盖节点:

🌐 Covered nodes:

陈述​

🌐 Statement

任何Statement的封面。

🌐 A cover of any Statements.

JavaScript
t.isStatement(node);

覆盖节点:

🌐 Covered nodes:

TS基础类型​

🌐 TSBaseType

主要 TypeScript 类型注释的封面。

🌐 A cover of primary TypeScript type annotations.

JavaScript
t.isTSBaseType(node);

覆盖节点:

🌐 Covered nodes:

TS实体名称​

🌐 TSEntityName

ts 实体的封面。

🌐 A cover of ts entities.

JavaScript
t.isTSEntityName(node);

覆盖节点:

🌐 Covered nodes:

类型​

🌐 TSType

TypeScript 类型注释的封面。

🌐 A cover of TypeScript type annotations.

JavaScript
t.isTSType(node);

覆盖节点:

🌐 Covered nodes:

TSType元素​

🌐 TSTypeElement

TypeScript 类型声明的封面。

🌐 A cover of TypeScript type declarations.

JavaScript
t.isTSTypeElement(node);

覆盖节点:

🌐 Covered nodes:

无终端​

🌐 Terminatorless

当在运算符和操作数之间插入行终止符时,其语义将发生变化的 AST 节点的覆盖。

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

JavaScript
t.isTerminatorless(node);

覆盖节点:

🌐 Covered nodes:

TypeScript​

为 TypeScript 定义的 AST 节点的封面。

🌐 A cover of AST nodes defined for TypeScript.

JavaScript
t.isTypeScript(node);

覆盖节点:

🌐 Covered nodes:

UnaryLike​

UnaryExpression 和 SpreadElement 的封面。

🌐 A cover of UnaryExpression and SpreadElement.

JavaScript
t.isUnaryLike(node);

覆盖节点:

🌐 Covered nodes:

UserWhitespacable​

已弃用,将在 Babel 8 中移除。

🌐 Deprecated. Will be removed in Babel 8.

JavaScript
t.isUserWhitespacable(node);

覆盖节点:

🌐 Covered nodes:

尽管​

🌐 While

DoWhileStatement 和 WhileStatement 的封面,它们共享相同的 AST 形状。

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

JavaScript
t.isWhile(node);

覆盖节点:

🌐 Covered nodes: