Skip to main content

@babel/types

该模块包含手动构建 AST 和检查 AST 节点类型的方法。

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

安装

¥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:

  • elementsArray<null | Expression | SpreadElement>(默认:[]

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

别名: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:

  • elementsArray<null | PatternLike | LVal>(必填)

    ¥elements: Array<null | PatternLike | LVal> (required)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

别名:Standardized, Pattern, PatternLike, LVal

¥Aliases: Standardized, 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:

  • elementTypeFlowType(必填)

    ¥elementType: FlowType (required)

别名: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:

  • paramsArray<Identifier | Pattern | RestElement>(必填)

    ¥params: Array<Identifier | Pattern | RestElement> (required)

  • bodyBlockStatement | Expression(必填)

    ¥body: BlockStatement | Expression (required)

  • asyncboolean(默认:false

    ¥async: boolean (default: false)

  • expressionboolean(必填)

    ¥expression: boolean (required)

  • generatorboolean(默认值:false,从构建器功能中排除)

    ¥generator: boolean (default: false, excluded from builder function)

  • predicateDeclaredPredicate | InferredPredicate(默认值:null,从构建器功能中排除)

    ¥predicate: DeclaredPredicate | InferredPredicate (default: null, excluded from builder function)

  • returnTypeTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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:

  • operatorstring(必填)

    ¥operator: string (required)

  • leftLVal | OptionalMemberExpression(必填)

    ¥left: LVal | OptionalMemberExpression (required)

  • rightExpression(必填)

    ¥right: Expression (required)

别名: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:

  • leftIdentifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression(必填)

    ¥left: Identifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression (required)

  • rightExpression(必填)

    ¥right: Expression (required)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

别名:Standardized, Pattern, PatternLike, LVal

¥Aliases: Standardized, 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:

  • argumentExpression(必填)

    ¥argument: Expression (required)

别名: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:

  • valuestring(必填)

    ¥value: string (required)

别名: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" | ">" | "<" | ">=" | "<=" | "|>"(必填)

    ¥operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>" (required)

  • leftExpression | PrivateName(必填)

    ¥left: Expression | PrivateName (required)

  • rightExpression(必填)

    ¥right: Expression (required)

别名: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:

  • objectExpression(必填)

    ¥object: Expression (required)

  • calleeExpression(必填)

    ¥callee: Expression (required)

别名: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:

  • bodyArray<Statement>(必填)

    ¥body: Array<Statement> (required)

  • directivesArray<Directive>(默认:[]

    ¥directives: Array<Directive> (default: [])

别名: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:

  • valueboolean(必填)

    ¥value: boolean (required)

别名: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:

  • valueboolean(必填)

    ¥value: boolean (required)

别名: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:

  • labelIdentifier(默认:null

    ¥label: Identifier (default: 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:

  • calleeExpression | Super | V8IntrinsicIdentifier(必填)

    ¥callee: Expression | Super | V8IntrinsicIdentifier (required)

  • argumentsArray<Expression | SpreadElement | ArgumentPlaceholder>(必填)

    ¥arguments: Array<Expression | SpreadElement | ArgumentPlaceholder> (required)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • typeArgumentsTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeArguments: TypeParameterInstantiation (default: null, excluded from builder function)

  • typeParametersTSTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeParameters: TSTypeParameterInstantiation (default: null, excluded from builder function)

别名: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:

  • paramIdentifier | ArrayPattern | ObjectPattern(默认:null

    ¥param: Identifier | ArrayPattern | ObjectPattern (default: null)

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

别名: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:

  • keyIdentifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName(必填)

    ¥key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName (required)

  • valueExpression(默认:null

    ¥value: Expression (default: null)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认:null

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null)

  • decoratorsArray<Decorator>(默认:null

    ¥decorators: Array<Decorator> (default: null)

  • computedboolean(默认:false

    ¥computed: boolean (default: false)

  • staticboolean(默认:false

    ¥static: boolean (default: false)

  • abstractboolean(默认值:null,从构建器功能中排除)

    ¥abstract: boolean (default: null, excluded from builder function)

  • accessibility"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

  • definiteboolean(默认值:null,从构建器功能中排除)

    ¥definite: boolean (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • overrideboolean(默认值:false,从构建器功能中排除)

    ¥override: boolean (default: false, excluded from builder function)

  • readonlyboolean(默认值:null,从构建器功能中排除)

    ¥readonly: boolean (default: null, excluded from builder function)

  • varianceVariance(默认值:null,从构建器功能中排除)

    ¥variance: Variance (default: null, excluded from builder function)

别名: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:

  • bodyArray<ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock>(必填)

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

别名: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:

  • idIdentifier(默认:null

    ¥id: Identifier (default: null)

  • superClassExpression(默认:null

    ¥superClass: Expression (default: null)

  • bodyClassBody(必填)

    ¥body: ClassBody (required)

  • decoratorsArray<Decorator>(默认:null

    ¥decorators: Array<Decorator> (default: null)

  • abstractboolean(默认值:null,从构建器功能中排除)

    ¥abstract: boolean (default: null, excluded from builder function)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

  • implementsArray<TSExpressionWithTypeArguments | ClassImplements>(默认值:null,从构建器功能中排除)

    ¥implements: Array<TSExpressionWithTypeArguments | ClassImplements> (default: null, excluded from builder function)

  • mixinsInterfaceExtends(默认值:null,从构建器功能中排除)

    ¥mixins: InterfaceExtends (default: null, excluded from builder function)

  • superTypeParametersTypeParameterInstantiation | TSTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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:

  • idIdentifier(默认:null

    ¥id: Identifier (default: null)

  • superClassExpression(默认:null

    ¥superClass: Expression (default: null)

  • bodyClassBody(必填)

    ¥body: ClassBody (required)

  • decoratorsArray<Decorator>(默认:null

    ¥decorators: Array<Decorator> (default: null)

  • implementsArray<TSExpressionWithTypeArguments | ClassImplements>(默认值:null,从构建器功能中排除)

    ¥implements: Array<TSExpressionWithTypeArguments | ClassImplements> (default: null, excluded from builder function)

  • mixinsInterfaceExtends(默认值:null,从构建器功能中排除)

    ¥mixins: InterfaceExtends (default: null, excluded from builder function)

  • superTypeParametersTypeParameterInstantiation | TSTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterInstantiation(默认:null

    ¥typeParameters: TypeParameterInstantiation (default: 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'

    ¥kind: "get" | "set" | "method" | "constructor" (default: 'method')

  • key:如果计算则 Expression 否则 Identifier | Literal(必需)

    ¥key: if computed then Expression else Identifier | Literal (required)

  • paramsArray<Identifier | Pattern | RestElement | TSParameterProperty>(必填)

    ¥params: Array<Identifier | Pattern | RestElement | TSParameterProperty> (required)

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

  • computedboolean(默认:false

    ¥computed: boolean (default: false)

  • staticboolean(默认:false

    ¥static: boolean (default: false)

  • generatorboolean(默认:false

    ¥generator: boolean (default: false)

  • asyncboolean(默认:false

    ¥async: boolean (default: false)

  • abstractboolean(默认值:null,从构建器功能中排除)

    ¥abstract: boolean (default: null, excluded from builder function)

  • access"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥access: "public" | "private" | "protected" (default: null, excluded from builder function)

  • accessibility"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • overrideboolean(默认值:false,从构建器功能中排除)

    ¥override: boolean (default: false, excluded from builder function)

  • returnTypeTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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'

    ¥kind: "get" | "set" | "method" (default: 'method')

  • keyPrivateName(必填)

    ¥key: PrivateName (required)

  • paramsArray<Identifier | Pattern | RestElement | TSParameterProperty>(必填)

    ¥params: Array<Identifier | Pattern | RestElement | TSParameterProperty> (required)

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

  • staticboolean(默认:false

    ¥static: boolean (default: false)

  • abstractboolean(默认值:null,从构建器功能中排除)

    ¥abstract: boolean (default: null, excluded from builder function)

  • access"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥access: "public" | "private" | "protected" (default: null, excluded from builder function)

  • accessibility"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)

  • asyncboolean(默认值:false,从构建器功能中排除)

    ¥async: boolean (default: false, excluded from builder function)

  • computed:'false'(默认值:false,从构建器功能中排除)

    ¥computed: 'false' (default: false, excluded from builder function)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • generatorboolean(默认值:false,从构建器功能中排除)

    ¥generator: boolean (default: false, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • overrideboolean(默认值:false,从构建器功能中排除)

    ¥override: boolean (default: false, excluded from builder function)

  • returnTypeTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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:

  • keyPrivateName(必填)

    ¥key: PrivateName (required)

  • valueExpression(默认:null

    ¥value: Expression (default: null)

  • decoratorsArray<Decorator>(默认:null

    ¥decorators: Array<Decorator> (default: null)

  • staticboolean(默认:false

    ¥static: boolean (default: false)

  • definiteboolean(默认值:null,从构建器功能中排除)

    ¥definite: boolean (default: null, excluded from builder function)

  • readonlyboolean(默认值:null,从构建器功能中排除)

    ¥readonly: boolean (default: null, excluded from builder function)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

  • varianceVariance(默认值:null,从构建器功能中排除)

    ¥variance: Variance (default: null, excluded from builder function)

别名:Standardized, Property, Private

¥Aliases: Standardized, Property, Private


classProperty

JavaScript
t.classProperty(key, value, typeAnnotation, decorators, computed, static);
History
版本变化
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:

  • keyIdentifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression(必填)

    ¥key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression (required)

  • valueExpression(默认:null

    ¥value: Expression (default: null)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认:null

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null)

  • decoratorsArray<Decorator>(默认:null

    ¥decorators: Array<Decorator> (default: null)

  • computedboolean(默认:false

    ¥computed: boolean (default: false)

  • staticboolean(默认:false

    ¥static: boolean (default: false)

  • abstractboolean(默认值:null,从构建器功能中排除)

    ¥abstract: boolean (default: null, excluded from builder function)

  • accessibility"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

  • definiteboolean(默认值:null,从构建器功能中排除)

    ¥definite: boolean (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • overrideboolean(默认值:false,从构建器功能中排除)

    ¥override: boolean (default: false, excluded from builder function)

  • readonlyboolean(默认值:null,从构建器功能中排除)

    ¥readonly: boolean (default: null, excluded from builder function)

  • varianceVariance(默认值:null,从构建器功能中排除)

    ¥variance: Variance (default: null, excluded from builder function)

别名: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:

  • testExpression(必填)

    ¥test: Expression (required)

  • consequentExpression(必填)

    ¥consequent: Expression (required)

  • alternateExpression(必填)

    ¥alternate: Expression (required)

别名: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:

  • labelIdentifier(默认:null

    ¥label: Identifier (default: 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:

  • valuestring(必填)

    ¥value: string (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • extendsArray<InterfaceExtends>(默认:null

    ¥extends: Array<InterfaceExtends> (default: null)

  • bodyObjectTypeAnnotation(必填)

    ¥body: ObjectTypeAnnotation (required)

  • implementsArray<ClassImplements>(默认值:null,从构建器功能中排除)

    ¥implements: Array<ClassImplements> (default: null, excluded from builder function)

  • mixinsArray<InterfaceExtends>(默认值:null,从构建器功能中排除)

    ¥mixins: Array<InterfaceExtends> (default: null, excluded from builder function)

别名:Flow, FlowDeclaration, Statement, Declaration

¥Aliases: Flow, FlowDeclaration, Statement, Declaration


declareExportAllDeclaration

JavaScript
t.declareExportAllDeclaration(source);

另见 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:

  • sourceStringLiteral(必填)

    ¥source: StringLiteral (required)

  • exportKind"type" | "value"(默认值:null,从构建器功能中排除)

    ¥exportKind: "type" | "value" (default: null, excluded from builder function)

别名:Flow, FlowDeclaration, Statement, Declaration

¥Aliases: Flow, FlowDeclaration, Statement, Declaration


declareExportDeclaration

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

另见 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:

  • declarationFlow(默认:null

    ¥declaration: Flow (default: null)

  • specifiersArray<ExportSpecifier | ExportNamespaceSpecifier>(默认:null

    ¥specifiers: Array<ExportSpecifier | ExportNamespaceSpecifier> (default: null)

  • sourceStringLiteral(默认:null

    ¥source: StringLiteral (default: null)

  • defaultboolean(默认值:null,从构建器功能中排除)

    ¥default: boolean (default: null, excluded from builder function)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • predicateDeclaredPredicate(默认值:null,从构建器功能中排除)

    ¥predicate: DeclaredPredicate (default: null, excluded from builder function)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • extendsArray<InterfaceExtends>(默认:null

    ¥extends: Array<InterfaceExtends> (default: null)

  • bodyObjectTypeAnnotation(必填)

    ¥body: ObjectTypeAnnotation (required)

别名: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:

  • idIdentifier | StringLiteral(必填)

    ¥id: Identifier | StringLiteral (required)

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

  • kind"CommonJS" | "ES"(默认:null

    ¥kind: "CommonJS" | "ES" (default: 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:

  • typeAnnotationTypeAnnotation(必填)

    ¥typeAnnotation: TypeAnnotation (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • supertypeFlowType(默认:null

    ¥supertype: FlowType (default: null)

  • impltypeFlowType(默认值:null,从构建器功能中排除)

    ¥impltype: FlowType (default: null, excluded from builder function)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • rightFlowType(必填)

    ¥right: FlowType (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

别名: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:

  • valueFlow(必填)

    ¥value: Flow (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)


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:

  • valueDirectiveLiteral(必填)

    ¥value: DirectiveLiteral (required)

别名: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:

  • valuestring(必填)

    ¥value: string (required)

别名: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:

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

  • asyncboolean(默认:false

    ¥async: boolean (default: 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:

  • testExpression(必填)

    ¥test: Expression (required)

  • bodyStatement(必填)

    ¥body: Statement (required)

别名: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:

  • membersArray<EnumBooleanMember>(必填)

    ¥members: Array<EnumBooleanMember> (required)

  • explicitTypeboolean(必填)

    ¥explicitType: boolean (required)

  • hasUnknownMembersboolean(必填)

    ¥hasUnknownMembers: boolean (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • initBooleanLiteral(必填)

    ¥init: BooleanLiteral (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • bodyEnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody(必填)

    ¥body: EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

别名: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:

  • membersArray<EnumNumberMember>(必填)

    ¥members: Array<EnumNumberMember> (required)

  • explicitTypeboolean(必填)

    ¥explicitType: boolean (required)

  • hasUnknownMembersboolean(必填)

    ¥hasUnknownMembers: boolean (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • initNumericLiteral(必填)

    ¥init: NumericLiteral (required)

别名: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:

  • membersArray<EnumStringMember | EnumDefaultedMember>(必填)

    ¥members: Array<EnumStringMember | EnumDefaultedMember> (required)

  • explicitTypeboolean(必填)

    ¥explicitType: boolean (required)

  • hasUnknownMembersboolean(必填)

    ¥hasUnknownMembers: boolean (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • initStringLiteral(必填)

    ¥init: StringLiteral (required)

别名: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:

  • membersArray<EnumDefaultedMember>(必填)

    ¥members: Array<EnumDefaultedMember> (required)

  • hasUnknownMembersboolean(必填)

    ¥hasUnknownMembers: boolean (required)

别名: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);

另见 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:

  • sourceStringLiteral(必填)

    ¥source: StringLiteral (required)

  • assertionsArray<ImportAttribute>(默认值:null,从构建器功能中排除)

    ¥assertions: Array<ImportAttribute> (default: null, excluded from builder function)

  • attributesArray<ImportAttribute>(默认值:null,从构建器功能中排除)

    ¥attributes: Array<ImportAttribute> (default: null, excluded from builder function)

  • exportKind"type" | "value"(默认值:null,从构建器功能中排除)

    ¥exportKind: "type" | "value" (default: null, excluded from builder function)

别名: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:

  • declarationTSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression(必填)

    ¥declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression (required)

  • exportKind"value"(默认值:null,从构建器功能中排除)

    ¥exportKind: "value" (default: null, excluded from builder function)

别名: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:

  • exportedIdentifier(必填)

    ¥exported: Identifier (required)

别名:ModuleSpecifier

¥Aliases: ModuleSpecifier


exportNamedDeclaration

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

另见 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:

  • declarationDeclaration(默认:null

    ¥declaration: Declaration (default: null)

  • specifiersArray<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier>(默认:[]

    ¥specifiers: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier> (default: [])

  • sourceStringLiteral(默认:null

    ¥source: StringLiteral (default: null)

  • assertionsArray<ImportAttribute>(默认值:null,从构建器功能中排除)

    ¥assertions: Array<ImportAttribute> (default: null, excluded from builder function)

  • attributesArray<ImportAttribute>(默认值:null,从构建器功能中排除)

    ¥attributes: Array<ImportAttribute> (default: null, excluded from builder function)

  • exportKind"type" | "value"(默认值:null,从构建器功能中排除)

    ¥exportKind: "type" | "value" (default: null, excluded from builder function)

别名: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:

  • exportedIdentifier(必填)

    ¥exported: Identifier (required)

别名: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:

  • localIdentifier(必填)

    ¥local: Identifier (required)

  • exportedIdentifier | StringLiteral(必填)

    ¥exported: Identifier | StringLiteral (required)

  • exportKind"type" | "value"(默认值:null,从构建器功能中排除)

    ¥exportKind: "type" | "value" (default: null, excluded from builder function)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

别名: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:

  • programProgram(必填)

    ¥program: Program (required)

  • commentsArray<CommentBlock | CommentLine>(默认:null

    ¥comments: Array<CommentBlock | CommentLine> (default: null)

  • tokensArray<any>(默认:null

    ¥tokens: Array<any> (default: 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:

  • leftVariableDeclaration | LVal(必填)

    ¥left: VariableDeclaration | LVal (required)

  • rightExpression(必填)

    ¥right: Expression (required)

  • bodyStatement(必填)

    ¥body: Statement (required)

别名: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:

  • leftVariableDeclaration | LVal(必填)

    ¥left: VariableDeclaration | LVal (required)

  • rightExpression(必填)

    ¥right: Expression (required)

  • bodyStatement(必填)

    ¥body: Statement (required)

  • awaitboolean(默认:false

    ¥await: boolean (default: 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:

  • initVariableDeclaration | Expression(默认:null

    ¥init: VariableDeclaration | Expression (default: null)

  • testExpression(默认:null

    ¥test: Expression (default: null)

  • updateExpression(默认:null

    ¥update: Expression (default: null)

  • bodyStatement(必填)

    ¥body: Statement (required)

别名: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:

  • idIdentifier(默认:null

    ¥id: Identifier (default: null)

  • paramsArray<Identifier | Pattern | RestElement>(必填)

    ¥params: Array<Identifier | Pattern | RestElement> (required)

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

  • generatorboolean(默认:false

    ¥generator: boolean (default: false)

  • asyncboolean(默认:false

    ¥async: boolean (default: false)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

  • predicateDeclaredPredicate | InferredPredicate(默认值:null,从构建器功能中排除)

    ¥predicate: DeclaredPredicate | InferredPredicate (default: null, excluded from builder function)

  • returnTypeTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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:

  • idIdentifier(默认:null

    ¥id: Identifier (default: null)

  • paramsArray<Identifier | Pattern | RestElement>(必填)

    ¥params: Array<Identifier | Pattern | RestElement> (required)

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

  • generatorboolean(默认:false

    ¥generator: boolean (default: false)

  • asyncboolean(默认:false

    ¥async: boolean (default: false)

  • predicateDeclaredPredicate | InferredPredicate(默认值:null,从构建器功能中排除)

    ¥predicate: DeclaredPredicate | InferredPredicate (default: null, excluded from builder function)

  • returnTypeTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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:

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • paramsArray<FunctionTypeParam>(必填)

    ¥params: Array<FunctionTypeParam> (required)

  • restFunctionTypeParam(默认:null

    ¥rest: FunctionTypeParam (default: null)

  • returnTypeFlowType(必填)

    ¥returnType: FlowType (required)

  • thisFunctionTypeParam(默认值:null,从构建器功能中排除)

    ¥this: FunctionTypeParam (default: null, excluded from builder function)

别名: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:

  • nameIdentifier(默认:null

    ¥name: Identifier (default: null)

  • typeAnnotationFlowType(必填)

    ¥typeAnnotation: FlowType (required)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

别名: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:

  • idIdentifier | QualifiedTypeIdentifier(必填)

    ¥id: Identifier | QualifiedTypeIdentifier (required)

  • typeParametersTypeParameterInstantiation(默认:null

    ¥typeParameters: TypeParameterInstantiation (default: 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:

  • namestring(必填)

    ¥name: string (required)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

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

¥Aliases: Standardized, Expression, 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:

  • testExpression(必填)

    ¥test: Expression (required)

  • consequentStatement(必填)

    ¥consequent: Statement (required)

  • alternateStatement(默认:null

    ¥alternate: Statement (default: 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:

  • keyIdentifier | StringLiteral(必填)

    ¥key: Identifier | StringLiteral (required)

  • valueStringLiteral(必填)

    ¥value: StringLiteral (required)


importDeclaration

JavaScript
t.importDeclaration(specifiers, source);
History
版本变化
v7.20.0支持 module

另见 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:

  • specifiersArray<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>(必填)

    ¥specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier> (required)

  • sourceStringLiteral(必填)

    ¥source: StringLiteral (required)

  • assertionsArray<ImportAttribute>(默认值:null,从构建器功能中排除)

    ¥assertions: Array<ImportAttribute> (default: null, excluded from builder function)

  • attributesArray<ImportAttribute>(默认值:null,从构建器功能中排除)

    ¥attributes: Array<ImportAttribute> (default: null, excluded from builder function)

  • importKind"type" | "typeof" | "value"(默认值:null,从构建器功能中排除)

    ¥importKind: "type" | "typeof" | "value" (default: null, excluded from builder function)

  • moduleboolean(默认值:null,从构建器功能中排除)

    ¥module: boolean (default: null, excluded from builder function)

  • phase"source" | "defer"(默认值:null,从构建器功能中排除)

    ¥phase: "source" | "defer" (default: null, excluded from builder function)

别名: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:

  • localIdentifier(必填)

    ¥local: Identifier (required)

别名: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:

  • sourceExpression(必填)

    ¥source: Expression (required)

  • optionsExpression(默认:null

    ¥options: Expression (default: null)

  • phase"source" | "defer"(默认值:null,从构建器功能中排除)

    ¥phase: "source" | "defer" (default: null, excluded from builder function)

别名: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:

  • localIdentifier(必填)

    ¥local: Identifier (required)

别名: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:

  • localIdentifier(必填)

    ¥local: Identifier (required)

  • importedIdentifier | StringLiteral(必填)

    ¥imported: Identifier | StringLiteral (required)

  • importKind"type" | "typeof" | "value"(默认值:null,从构建器功能中排除)

    ¥importKind: "type" | "typeof" | "value" (default: null, excluded from builder function)

别名: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:

  • objectTypeFlowType(必填)

    ¥objectType: FlowType (required)

  • indexTypeFlowType(必填)

    ¥indexType: FlowType (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • extendsArray<InterfaceExtends>(默认:null

    ¥extends: Array<InterfaceExtends> (default: null)

  • bodyObjectTypeAnnotation(必填)

    ¥body: ObjectTypeAnnotation (required)

别名: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:

  • idIdentifier | QualifiedTypeIdentifier(必填)

    ¥id: Identifier | QualifiedTypeIdentifier (required)

  • typeParametersTypeParameterInstantiation(默认:null

    ¥typeParameters: TypeParameterInstantiation (default: 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:

  • extendsArray<InterfaceExtends>(默认:null

    ¥extends: Array<InterfaceExtends> (default: null)

  • bodyObjectTypeAnnotation(必填)

    ¥body: ObjectTypeAnnotation (required)

别名: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:

  • valuestring(必填)

    ¥value: string (required)

别名: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:

  • typesArray<FlowType>(必填)

    ¥types: Array<FlowType> (required)

别名: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:

  • nameJSXIdentifier | JSXNamespacedName(必填)

    ¥name: JSXIdentifier | JSXNamespacedName (required)

  • valueJSXElement | JSXFragment | StringLiteral | JSXExpressionContainer(默认:null

    ¥value: JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer (default: 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:

  • nameJSXIdentifier | JSXMemberExpression | JSXNamespacedName(必填)

    ¥name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName (required)

别名: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:

  • openingElementJSXOpeningElement(必填)

    ¥openingElement: JSXOpeningElement (required)

  • closingElementJSXClosingElement(默认:null

    ¥closingElement: JSXClosingElement (default: null)

  • childrenArray<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment>(必填)

    ¥children: Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment> (required)

  • selfClosingboolean(默认:null

    ¥selfClosing: boolean (default: 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:

  • expressionExpression | JSXEmptyExpression(必填)

    ¥expression: Expression | JSXEmptyExpression (required)

别名: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:

  • openingFragmentJSXOpeningFragment(必填)

    ¥openingFragment: JSXOpeningFragment (required)

  • closingFragmentJSXClosingFragment(必填)

    ¥closingFragment: JSXClosingFragment (required)

  • childrenArray<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment>(必填)

    ¥children: Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment> (required)

别名: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:

  • namestring(必填)

    ¥name: string (required)

别名: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:

  • objectJSXMemberExpression | JSXIdentifier(必填)

    ¥object: JSXMemberExpression | JSXIdentifier (required)

  • propertyJSXIdentifier(必填)

    ¥property: JSXIdentifier (required)

别名: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:

  • namespaceJSXIdentifier(必填)

    ¥namespace: JSXIdentifier (required)

  • nameJSXIdentifier(必填)

    ¥name: JSXIdentifier (required)

别名: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:

  • nameJSXIdentifier | JSXMemberExpression | JSXNamespacedName(必填)

    ¥name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName (required)

  • attributesArray<JSXAttribute | JSXSpreadAttribute>(必填)

    ¥attributes: Array<JSXAttribute | JSXSpreadAttribute> (required)

  • selfClosingboolean(默认:false

    ¥selfClosing: boolean (default: false)

  • typeParametersTypeParameterInstantiation | TSTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)

别名: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:

  • argumentExpression(必填)

    ¥argument: Expression (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

别名: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:

  • valuestring(必填)

    ¥value: string (required)

别名: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:

  • labelIdentifier(必填)

    ¥label: Identifier (required)

  • bodyStatement(必填)

    ¥body: Statement (required)

别名: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"||" | "&&" | "??"(必填)

    ¥operator: "||" | "&&" | "??" (required)

  • leftExpression(必填)

    ¥left: Expression (required)

  • rightExpression(必填)

    ¥right: Expression (required)

别名: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:

  • objectExpression | Super(必填)

    ¥object: Expression | Super (required)

  • property:如果计算则 Expression 否则 Identifier(必需)

    ¥property: if computed then Expression else Identifier (required)

  • computedboolean(默认:false

    ¥computed: boolean (default: false)

  • optionalboolean(默认:null

    ¥optional: boolean (default: null)

别名:Standardized, Expression, LVal

¥Aliases: Standardized, Expression, LVal


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:

  • metaIdentifier(必填)

    ¥meta: Identifier (required)

  • propertyIdentifier(必填)

    ¥property: Identifier (required)

别名: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:

  • bodyProgram(必填)

    ¥body: Program (required)

别名: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:

  • calleeExpression | Super | V8IntrinsicIdentifier(必填)

    ¥callee: Expression | Super | V8IntrinsicIdentifier (required)

  • argumentsArray<Expression | SpreadElement | ArgumentPlaceholder>(必填)

    ¥arguments: Array<Expression | SpreadElement | ArgumentPlaceholder> (required)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • typeArgumentsTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeArguments: TypeParameterInstantiation (default: null, excluded from builder function)

  • typeParametersTSTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeParameters: TSTypeParameterInstantiation (default: null, excluded from builder function)

别名: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:

  • typeAnnotationFlowType(必填)

    ¥typeAnnotation: FlowType (required)

别名: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:

  • valuenumber(必填)

    ¥value: number (required)

别名: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(必需)

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

别名: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:

  • propertiesArray<ObjectMethod | ObjectProperty | SpreadElement>(必填)

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

别名: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'

    ¥kind: "method" | "get" | "set" (default: 'method')

  • key:如果计算则 Expression 否则 Identifier | Literal(必需)

    ¥key: if computed then Expression else Identifier | Literal (required)

  • paramsArray<Identifier | Pattern | RestElement>(必填)

    ¥params: Array<Identifier | Pattern | RestElement> (required)

  • bodyBlockStatement(必填)

    ¥body: BlockStatement (required)

  • computedboolean(默认:false

    ¥computed: boolean (default: false)

  • generatorboolean(默认:false

    ¥generator: boolean (default: false)

  • asyncboolean(默认:false

    ¥async: boolean (default: false)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • returnTypeTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥returnType: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

  • typeParametersTypeParameterDeclaration | TSTypeParameterDeclaration | Noop(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (default: null, excluded from builder function)

别名: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:

  • propertiesArray<RestElement | ObjectProperty>(必填)

    ¥properties: Array<RestElement | ObjectProperty> (required)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

别名:Standardized, Pattern, PatternLike, LVal

¥Aliases: Standardized, 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(必需)

    ¥key: if computed then Expression else Identifier | Literal (required)

  • valueExpression | PatternLike(必填)

    ¥value: Expression | PatternLike (required)

  • computedboolean(默认:false

    ¥computed: boolean (default: false)

  • shorthandboolean(默认:false

    ¥shorthand: boolean (default: false)

  • decoratorsArray<Decorator>(默认:null

    ¥decorators: Array<Decorator> (default: 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:

  • propertiesArray<ObjectTypeProperty | ObjectTypeSpreadProperty>(必填)

    ¥properties: Array<ObjectTypeProperty | ObjectTypeSpreadProperty> (required)

  • indexersArray<ObjectTypeIndexer>(默认:[]

    ¥indexers: Array<ObjectTypeIndexer> (default: [])

  • callPropertiesArray<ObjectTypeCallProperty>(默认:[]

    ¥callProperties: Array<ObjectTypeCallProperty> (default: [])

  • internalSlotsArray<ObjectTypeInternalSlot>(默认:[]

    ¥internalSlots: Array<ObjectTypeInternalSlot> (default: [])

  • exactboolean(默认:false

    ¥exact: boolean (default: false)

  • inexactboolean(默认值:null,从构建器功能中排除)

    ¥inexact: boolean (default: null, excluded from builder function)

别名: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:

  • valueFlowType(必填)

    ¥value: FlowType (required)

  • staticboolean(必填)

    ¥static: boolean (required)

别名: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:

  • idIdentifier(默认:null

    ¥id: Identifier (default: null)

  • keyFlowType(必填)

    ¥key: FlowType (required)

  • valueFlowType(必填)

    ¥value: FlowType (required)

  • varianceVariance(默认:null

    ¥variance: Variance (default: null)

  • staticboolean(必填)

    ¥static: boolean (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • valueFlowType(必填)

    ¥value: FlowType (required)

  • optionalboolean(必填)

    ¥optional: boolean (required)

  • staticboolean(必填)

    ¥static: boolean (required)

  • methodboolean(必填)

    ¥method: boolean (required)

别名: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:

  • keyIdentifier | StringLiteral(必填)

    ¥key: Identifier | StringLiteral (required)

  • valueFlowType(必填)

    ¥value: FlowType (required)

  • varianceVariance(默认:null

    ¥variance: Variance (default: null)

  • kind"init" | "get" | "set"(必填)

    ¥kind: "init" | "get" | "set" (required)

  • methodboolean(必填)

    ¥method: boolean (required)

  • optionalboolean(必填)

    ¥optional: boolean (required)

  • protoboolean(必填)

    ¥proto: boolean (required)

  • staticboolean(必填)

    ¥static: boolean (required)

别名: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:

  • argumentFlowType(必填)

    ¥argument: FlowType (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • supertypeFlowType(默认:null

    ¥supertype: FlowType (default: null)

  • impltypeFlowType(必填)

    ¥impltype: FlowType (required)

别名: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:

  • calleeExpression(必填)

    ¥callee: Expression (required)

  • argumentsArray<Expression | SpreadElement | ArgumentPlaceholder>(必填)

    ¥arguments: Array<Expression | SpreadElement | ArgumentPlaceholder> (required)

  • optionalboolean(必填)

    ¥optional: boolean (required)

  • typeArgumentsTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeArguments: TypeParameterInstantiation (default: null, excluded from builder function)

  • typeParametersTSTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeParameters: TSTypeParameterInstantiation (default: null, excluded from builder function)

别名: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:

  • objectTypeFlowType(必填)

    ¥objectType: FlowType (required)

  • indexTypeFlowType(必填)

    ¥indexType: FlowType (required)

  • optionalboolean(必填)

    ¥optional: boolean (required)

别名: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:

  • objectExpression(必填)

    ¥object: Expression (required)

  • propertyExpression | Identifier(必填)

    ¥property: Expression | Identifier (required)

  • computedboolean(默认:false

    ¥computed: boolean (default: false)

  • optionalboolean(必填)

    ¥optional: boolean (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

别名: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:

  • calleeExpression(必填)

    ¥callee: Expression (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

别名: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"(必填)

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

  • nameIdentifier(必填)

    ¥name: Identifier (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

别名: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:

  • bodyArray<Statement>(必填)

    ¥body: Array<Statement> (required)

  • directivesArray<Directive>(默认:[]

    ¥directives: Array<Directive> (default: [])

  • sourceType"script" | "module"(默认:'script'

    ¥sourceType: "script" | "module" (default: 'script')

  • interpreterInterpreterDirective(默认:null

    ¥interpreter: InterpreterDirective (default: 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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • qualificationIdentifier | QualifiedTypeIdentifier(必填)

    ¥qualification: Identifier | QualifiedTypeIdentifier (required)

别名: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:

  • propertiesArray<ObjectProperty | SpreadElement>(必填)

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

别名: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:

  • patternstring(必填)

    ¥pattern: string (required)

  • flagsstring(默认:''

    ¥flags: string (default: '')

别名: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:

  • argumentLVal(必填)

    ¥argument: LVal (required)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(默认值:null,从构建器功能中排除)

    ¥typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (default: null, excluded from builder function)

别名:Standardized, LVal, PatternLike

¥Aliases: Standardized, LVal, PatternLike


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:

  • argumentExpression(默认:null

    ¥argument: Expression (default: 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:

  • expressionsArray<Expression>(必填)

    ¥expressions: Array<Expression> (required)

别名: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:

  • argumentExpression(必填)

    ¥argument: Expression (required)

别名: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:

  • bodyArray<Statement>(必填)

    ¥body: Array<Statement> (required)

别名: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:

  • valuestring(必填)

    ¥value: string (required)

别名: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:

  • valuestring(必填)

    ¥value: string (required)

别名: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:

  • testExpression(默认:null

    ¥test: Expression (default: null)

  • consequentArray<Statement>(必填)

    ¥consequent: Array<Statement> (required)

别名: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:

  • discriminantExpression(必填)

    ¥discriminant: Expression (required)

  • casesArray<SwitchCase>(必填)

    ¥cases: Array<SwitchCase> (required)

别名: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:

  • elementTypeTSType(必填)

    ¥elementType: TSType (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

别名: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:

  • typeParametersTSTypeParameterDeclaration(默认:null

    ¥typeParameters: TSTypeParameterDeclaration (default: null)

  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)

    ¥parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: 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:

  • checkTypeTSType(必填)

    ¥checkType: TSType (required)

  • extendsTypeTSType(必填)

    ¥extendsType: TSType (required)

  • trueTypeTSType(必填)

    ¥trueType: TSType (required)

  • falseTypeTSType(必填)

    ¥falseType: TSType (required)

别名: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:

  • typeParametersTSTypeParameterDeclaration(默认:null

    ¥typeParameters: TSTypeParameterDeclaration (default: null)

  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)

    ¥parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: 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:

  • typeParametersTSTypeParameterDeclaration(默认:null

    ¥typeParameters: TSTypeParameterDeclaration (default: null)

  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)

    ¥parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: null)

  • abstractboolean(默认值:null,从构建器功能中排除)

    ¥abstract: boolean (default: null, excluded from builder function)

别名: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:

  • idIdentifier(默认:null

    ¥id: Identifier (default: null)

  • typeParametersTSTypeParameterDeclaration | Noop(默认:null

    ¥typeParameters: TSTypeParameterDeclaration | Noop (default: null)

  • paramsArray<Identifier | Pattern | RestElement>(必填)

    ¥params: Array<Identifier | Pattern | RestElement> (required)

  • returnTypeTSTypeAnnotation | Noop(默认:null

    ¥returnType: TSTypeAnnotation | Noop (default: null)

  • asyncboolean(默认值:false,从构建器功能中排除)

    ¥async: boolean (default: false, excluded from builder function)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

  • generatorboolean(默认值:false,从构建器功能中排除)

    ¥generator: boolean (default: false, excluded from builder function)

别名: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:

  • decoratorsArray<Decorator>(默认:null

    ¥decorators: Array<Decorator> (default: null)

  • keyIdentifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression(必填)

    ¥key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression (required)

  • typeParametersTSTypeParameterDeclaration | Noop(默认:null

    ¥typeParameters: TSTypeParameterDeclaration | Noop (default: null)

  • paramsArray<Identifier | Pattern | RestElement | TSParameterProperty>(必填)

    ¥params: Array<Identifier | Pattern | RestElement | TSParameterProperty> (required)

  • returnTypeTSTypeAnnotation | Noop(默认:null

    ¥returnType: TSTypeAnnotation | Noop (default: null)

  • abstractboolean(默认值:null,从构建器功能中排除)

    ¥abstract: boolean (default: null, excluded from builder function)

  • access"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥access: "public" | "private" | "protected" (default: null, excluded from builder function)

  • accessibility"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)

  • asyncboolean(默认值:false,从构建器功能中排除)

    ¥async: boolean (default: false, excluded from builder function)

  • computedboolean(默认值:false,从构建器功能中排除)

    ¥computed: boolean (default: false, excluded from builder function)

  • generatorboolean(默认值:false,从构建器功能中排除)

    ¥generator: boolean (default: false, excluded from builder function)

  • kind"get" | "set" | "method" | "constructor"(默认值:'method',从构建器功能中排除)

    ¥kind: "get" | "set" | "method" | "constructor" (default: 'method', excluded from builder function)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • overrideboolean(默认值:false,从构建器功能中排除)

    ¥override: boolean (default: false, excluded from builder function)

  • staticboolean(默认值:false,从构建器功能中排除)

    ¥static: boolean (default: false, excluded from builder function)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • membersArray<TSEnumMember>(必填)

    ¥members: Array<TSEnumMember> (required)

  • constboolean(默认值:null,从构建器功能中排除)

    ¥const: boolean (default: null, excluded from builder function)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

  • initializerExpression(默认值:null,从构建器功能中排除)

    ¥initializer: Expression (default: null, excluded from builder function)

别名: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:

  • idIdentifier | StringLiteral(必填)

    ¥id: Identifier | StringLiteral (required)

  • initializerExpression(默认:null

    ¥initializer: Expression (default: 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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

别名: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:

  • expressionTSEntityName(必填)

    ¥expression: TSEntityName (required)

  • typeParametersTSTypeParameterInstantiation(默认:null

    ¥typeParameters: TSTypeParameterInstantiation (default: 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:

  • expressionStringLiteral(必填)

    ¥expression: StringLiteral (required)

别名: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:

  • typeParametersTSTypeParameterDeclaration(默认:null

    ¥typeParameters: TSTypeParameterDeclaration (default: null)

  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)

    ¥parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: 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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • moduleReferenceTSEntityName | TSExternalModuleReference(必填)

    ¥moduleReference: TSEntityName | TSExternalModuleReference (required)

  • importKind"type" | "value"(默认值:null,从构建器功能中排除)

    ¥importKind: "type" | "value" (default: null, excluded from builder function)

  • isExportboolean(必填)

    ¥isExport: boolean (required)

别名:TypeScript, Statement

¥Aliases: TypeScript, Statement


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:

  • argumentStringLiteral(必填)

    ¥argument: StringLiteral (required)

  • qualifierTSEntityName(默认:null

    ¥qualifier: TSEntityName (default: null)

  • typeParametersTSTypeParameterInstantiation(默认:null

    ¥typeParameters: TSTypeParameterInstantiation (default: null)

  • optionsExpression(默认值:null,从构建器功能中排除)

    ¥options: Expression (default: null, excluded from builder function)

别名: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:

  • parametersArray<Identifier>(必填)

    ¥parameters: Array<Identifier> (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: null)

  • readonlyboolean(默认值:null,从构建器功能中排除)

    ¥readonly: boolean (default: null, excluded from builder function)

  • staticboolean(默认值:null,从构建器功能中排除)

    ¥static: boolean (default: null, excluded from builder function)

别名: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:

  • objectTypeTSType(必填)

    ¥objectType: TSType (required)

  • indexTypeTSType(必填)

    ¥indexType: TSType (required)

别名: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:

  • typeParameterTSTypeParameter(必填)

    ¥typeParameter: TSTypeParameter (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

  • typeParametersTSTypeParameterInstantiation(默认:null

    ¥typeParameters: TSTypeParameterInstantiation (default: 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:

  • bodyArray<TSTypeElement>(必填)

    ¥body: Array<TSTypeElement> (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTSTypeParameterDeclaration(默认:null

    ¥typeParameters: TSTypeParameterDeclaration (default: null)

  • extendsArray<TSExpressionWithTypeArguments>(默认:null

    ¥extends: Array<TSExpressionWithTypeArguments> (default: null)

  • bodyTSInterfaceBody(必填)

    ¥body: TSInterfaceBody (required)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

别名: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:

  • typesArray<TSType>(必填)

    ¥types: Array<TSType> (required)

别名: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:

  • literalNumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TemplateLiteral | UnaryExpression(必填)

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

别名: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:

  • typeParameterTSTypeParameter(必填)

    ¥typeParameter: TSTypeParameter (required)

  • typeAnnotationTSType(默认:null

    ¥typeAnnotation: TSType (default: null)

  • nameTypeTSType(默认:null

    ¥nameType: TSType (default: null)

  • optionaltrue | false | "+" | "-"(默认值:null,从构建器功能中排除)

    ¥optional: true | false | "+" | "-" (default: null, excluded from builder function)

  • readonlytrue | false | "+" | "-"(默认值:null,从构建器功能中排除)

    ¥readonly: true | false | "+" | "-" (default: null, excluded from builder function)

别名: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:

  • keyExpression(必填)

    ¥key: Expression (required)

  • typeParametersTSTypeParameterDeclaration(默认:null

    ¥typeParameters: TSTypeParameterDeclaration (default: null)

  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)

    ¥parameters: Array<ArrayPattern | Identifier | ObjectPattern | RestElement> (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: null)

  • computedboolean(默认值:false,从构建器功能中排除)

    ¥computed: boolean (default: false, excluded from builder function)

  • kind"method" | "get" | "set"(必填)

    ¥kind: "method" | "get" | "set" (required)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

别名: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:

  • bodyArray<Statement>(必填)

    ¥body: Array<Statement> (required)

别名: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:

  • idIdentifier | StringLiteral(必填)

    ¥id: Identifier | StringLiteral (required)

  • bodyTSModuleBlock | TSModuleDeclaration(必填)

    ¥body: TSModuleBlock | TSModuleDeclaration (required)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

  • globalboolean(默认值:null,从构建器功能中排除)

    ¥global: boolean (default: null, excluded from builder function)

别名: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:

  • labelIdentifier(必填)

    ¥label: Identifier (required)

  • elementTypeTSType(必填)

    ¥elementType: TSType (required)

  • optionalboolean(默认:false

    ¥optional: boolean (default: 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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

别名: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:

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

别名: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:

  • parameterIdentifier | AssignmentPattern(必填)

    ¥parameter: Identifier | AssignmentPattern (required)

  • accessibility"public" | "private" | "protected"(默认值:null,从构建器功能中排除)

    ¥accessibility: "public" | "private" | "protected" (default: null, excluded from builder function)

  • decoratorsArray<Decorator>(默认值:null,从构建器功能中排除)

    ¥decorators: Array<Decorator> (default: null, excluded from builder function)

  • overrideboolean(默认值:null,从构建器功能中排除)

    ¥override: boolean (default: null, excluded from builder function)

  • readonlyboolean(默认值:null,从构建器功能中排除)

    ¥readonly: boolean (default: null, excluded from builder function)

别名: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:

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

别名: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:

  • keyExpression(必填)

    ¥key: Expression (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: null)

  • computedboolean(默认值:false,从构建器功能中排除)

    ¥computed: boolean (default: false, excluded from builder function)

  • kind"get" | "set"(必填)

    ¥kind: "get" | "set" (required)

  • optionalboolean(默认值:null,从构建器功能中排除)

    ¥optional: boolean (default: null, excluded from builder function)

  • readonlyboolean(默认值:null,从构建器功能中排除)

    ¥readonly: boolean (default: null, excluded from builder function)

别名: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:

  • leftTSEntityName(必填)

    ¥left: TSEntityName (required)

  • rightIdentifier(必填)

    ¥right: Identifier (required)

别名: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:

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

别名:TypeScript, TSType

¥Aliases: TypeScript, TSType


tsSatisfiesExpression

JavaScript
t.tsSatisfiesExpression(expression, typeAnnotation);
History
版本变化
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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

别名: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


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:

  • elementTypesArray<TSType | TSNamedTupleMember>(必填)

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

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTSTypeParameterDeclaration(默认:null

    ¥typeParameters: TSTypeParameterDeclaration (default: null)

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

别名: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:

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

别名: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:

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

  • expressionExpression(必填)

    ¥expression: Expression (required)

别名: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:

  • membersArray<TSTypeElement>(必填)

    ¥members: Array<TSTypeElement> (required)

别名:TypeScript, TSType

¥Aliases: TypeScript, TSType


tsTypeOperator

JavaScript
t.tsTypeOperator(typeAnnotation);

另见 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:

  • typeAnnotationTSType(必填)

    ¥typeAnnotation: TSType (required)

  • operatorstring(必填)

    ¥operator: string (required)

别名:TypeScript, TSType

¥Aliases: TypeScript, TSType


tsTypeParameter

JavaScript
t.tsTypeParameter(constraint, default, name);
History
版本变化
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:

  • constraintTSType(默认:null

    ¥constraint: TSType (default: null)

  • defaultTSType(默认:null

    ¥default: TSType (default: null)

  • namestring(必填)

    ¥name: string (required)

  • constboolean(默认值:null,从构建器功能中排除)

    ¥const: boolean (default: null, excluded from builder function)

  • inboolean(默认值:null,从构建器功能中排除)

    ¥in: boolean (default: null, excluded from builder function)

  • outboolean(默认值:null,从构建器功能中排除)

    ¥out: boolean (default: null, excluded from builder function)

别名: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:

  • paramsArray<TSTypeParameter>(必填)

    ¥params: Array<TSTypeParameter> (required)

别名: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:

  • paramsArray<TSType>(必填)

    ¥params: Array<TSType> (required)

别名: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:

  • parameterNameIdentifier | TSThisType(必填)

    ¥parameterName: Identifier | TSThisType (required)

  • typeAnnotationTSTypeAnnotation(默认:null

    ¥typeAnnotation: TSTypeAnnotation (default: null)

  • assertsboolean(默认:null

    ¥asserts: boolean (default: 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:

  • exprNameTSEntityName | TSImportType(必填)

    ¥exprName: TSEntityName | TSImportType (required)

  • typeParametersTSTypeParameterInstantiation(默认:null

    ¥typeParameters: TSTypeParameterInstantiation (default: 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:

  • typeNameTSEntityName(必填)

    ¥typeName: TSEntityName (required)

  • typeParametersTSTypeParameterInstantiation(默认:null

    ¥typeParameters: TSTypeParameterInstantiation (default: 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:

  • typesArray<TSType>(必填)

    ¥types: Array<TSType> (required)

别名: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:

  • tagExpression(必填)

    ¥tag: Expression (required)

  • quasiTemplateLiteral(必填)

    ¥quasi: TemplateLiteral (required)

  • typeParametersTypeParameterInstantiation | TSTypeParameterInstantiation(默认值:null,从构建器功能中排除)

    ¥typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (default: null, excluded from builder function)

别名: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 }(必填)

    ¥value: { raw: string, cooked?: string } (required)

  • tailboolean(默认:false

    ¥tail: boolean (default: 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:

  • quasisArray<TemplateElement>(必填)

    ¥quasis: Array<TemplateElement> (required)

  • expressionsArray<Expression | TSType>(必填)

    ¥expressions: Array<Expression | TSType> (required)

别名: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:

  • argumentExpression(必填)

    ¥argument: Expression (required)

别名: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:

  • blockBlockStatement(必填)

    ¥block: BlockStatement (required)

  • handlerCatchClause(默认:null

    ¥handler: CatchClause (default: null)

  • finalizerBlockStatement(默认:null

    ¥finalizer: BlockStatement (default: 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:

  • elementsArray<Expression | SpreadElement>(默认:[]

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

别名: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:

  • typesArray<FlowType>(必填)

    ¥types: Array<FlowType> (required)

别名: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:

  • idIdentifier(必填)

    ¥id: Identifier (required)

  • typeParametersTypeParameterDeclaration(默认:null

    ¥typeParameters: TypeParameterDeclaration (default: null)

  • rightFlowType(必填)

    ¥right: FlowType (required)

别名: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:

  • typeAnnotationFlowType(必填)

    ¥typeAnnotation: FlowType (required)

别名: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:

  • expressionExpression(必填)

    ¥expression: Expression (required)

  • typeAnnotationTypeAnnotation(必填)

    ¥typeAnnotation: TypeAnnotation (required)

别名: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:

  • boundTypeAnnotation(默认:null

    ¥bound: TypeAnnotation (default: null)

  • defaultFlowType(默认:null

    ¥default: FlowType (default: null)

  • varianceVariance(默认:null

    ¥variance: Variance (default: null)

  • namestring(必填)

    ¥name: string (required)

别名: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:

  • paramsArray<TypeParameter>(必填)

    ¥params: Array<TypeParameter> (required)

别名: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:

  • paramsArray<FlowType>(必填)

    ¥params: Array<FlowType> (required)

别名: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:

  • argumentFlowType(必填)

    ¥argument: FlowType (required)

别名: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"(必填)

    ¥operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof" (required)

  • argumentExpression(必填)

    ¥argument: Expression (required)

  • prefixboolean(默认:true

    ¥prefix: boolean (default: 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:

  • typesArray<FlowType>(必填)

    ¥types: Array<FlowType> (required)

别名: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"++" | "--"(必填)

    ¥operator: "++" | "--" (required)

  • argumentExpression(必填)

    ¥argument: Expression (required)

  • prefixboolean(默认:false

    ¥prefix: boolean (default: false)

别名:Standardized, Expression

¥Aliases: Standardized, Expression


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:

  • namestring(必填)

    ¥name: string (required)

别名:Miscellaneous

¥Aliases: Miscellaneous


variableDeclaration

JavaScript
t.variableDeclaration(kind, declarations);
History
版本变化
v7.20.0kind 可以是 "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"(必填)

    ¥kind: "var" | "let" | "const" | "using" | "await using" (required)

  • declarationsArray<VariableDeclarator>(必填)

    ¥declarations: Array<VariableDeclarator> (required)

  • declareboolean(默认值:null,从构建器功能中排除)

    ¥declare: boolean (default: null, excluded from builder function)

别名: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:

  • idLVal(必填)

    ¥id: LVal (required)

  • initExpression(默认:null

    ¥init: Expression (default: null)

  • definiteboolean(默认值:null,从构建器功能中排除)

    ¥definite: boolean (default: null, excluded from builder function)

别名: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"(必填)

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

别名:Flow

¥Aliases: Flow


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:

  • testExpression(必填)

    ¥test: Expression (required)

  • bodyStatement(必填)

    ¥body: Statement (required)

别名: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:

  • objectExpression(必填)

    ¥object: Expression (required)

  • bodyStatement(必填)

    ¥body: Statement (required)

别名: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:

  • argumentExpression(默认:null

    ¥argument: Expression (default: null)

  • delegateboolean(默认:false

    ¥delegate: boolean (default: 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

以新的 LexicalEnvironment 开始执行上下文的 AST 节点的封面。换句话说,它们定义了 letconst 声明的范围。

¥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

任何 ExportDeclaration 的封面。

¥A cover of any ExportDeclarations.

JavaScript
t.isExportDeclaration(node);

覆盖节点:

¥Covered nodes:

表达

¥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

ForStatementForXStatement 的封面。

¥A cover of ForStatements and ForXStatements.

JavaScript
t.isFor(node);

覆盖节点:

¥Covered nodes:

ForXStatement

ForInStatements 和 ForOfStatements 的封面。

¥A cover of ForInStatements and ForOfStatements.

JavaScript
t.isForXStatement(node);

覆盖节点:

¥Covered nodes:

函数

¥Function

一个覆盖函数和 method,必须有 bodyparams。注意:FunctionFunctionParent 不同。例如,StaticBlockFunctionParent,但不是 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:

FunctionParent

以新的 VariableEnvironment 开始执行上下文的 AST 节点的封面。换句话说,它们定义了 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 元素的封面。如果创建后无法定义其他属性,则对象为 immutable

¥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

History
版本变化
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

赋值表达式的 leftForXStatement 中使用的左侧表达式的封面。

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

JavaScript
t.isLVal(node);

覆盖节点:

¥Covered nodes:

字面量

¥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

History
版本变化
v7.21.0弃用
提醒

已弃用,请改用 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

FunctionParentBlockParent 的封面。

¥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

任何 陈述 的封面。

¥A cover of any Statements.

JavaScript
t.isStatement(node);

覆盖节点:

¥Covered nodes:

TSBaseType

主要 TypeScript 类型注释的封面。

¥A cover of primary TypeScript type annotations.

JavaScript
t.isTSBaseType(node);

覆盖节点:

¥Covered nodes:

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:

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: