跳至主要內容

@babel/types

此模組包含用於手動建立 AST 和檢查 AST 節點類型的函式。

安裝

npm install --save-dev @babel/types

API

節點建立器

anyTypeAnnotation

JavaScript
t.anyTypeAnnotation();

另請參閱 t.isAnyTypeAnnotation(node, opts)t.assertAnyTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


argumentPlaceholder

JavaScript
t.argumentPlaceholder();

另請參閱 t.isArgumentPlaceholder(node, opts)t.assertArgumentPlaceholder(node, opts)


arrayExpression

JavaScript
t.arrayExpression(elements);

另請參閱 t.isArrayExpression(node, opts)t.assertArrayExpression(node, opts)

AST 節點 ArrayExpression 形狀

  • elementsArray<null | Expression | SpreadElement>(預設值:[]

別名:StandardizedExpression


arrayPattern

JavaScript
t.arrayPattern(elements);

另請參閱 t.isArrayPattern(node, opts)t.assertArrayPattern(node, opts)

AST 節點 ArrayPattern 形狀

  • elementsArray<null | PatternLike | LVal>(必要)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(預設值:null,從建立器函數中排除)

別名:StandardizedPatternPatternLikeLVal


arrayTypeAnnotation

JavaScript
t.arrayTypeAnnotation(elementType);

另請參閱 t.isArrayTypeAnnotation(node, opts)t.assertArrayTypeAnnotation(node, opts)

AST 節點 ArrayTypeAnnotation 形狀

  • elementType: FlowType(必要)

別名:FlowFlowType


arrowFunctionExpression

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

另請參閱 t.isArrowFunctionExpression(node, opts)t.assertArrowFunctionExpression(node, opts)

AST 節點 ArrowFunctionExpression 形狀

  • params: Array<Identifier | Pattern | RestElement>(必要)
  • body: BlockStatement | Expression(必要)
  • async: boolean(預設:false
  • expression: boolean(必要)
  • generator: boolean(預設:false,從建構函數中排除)
  • predicate: DeclaredPredicate | InferredPredicate(預設:null,從建構函數中排除)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop(預設:null,從建構函數中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

別名:StandardizedScopableFunctionBlockParentFunctionParentExpressionPureish


assignmentExpression

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

另請參閱 t.isAssignmentExpression(node, opts)t.assertAssignmentExpression(node, opts)

AST 節點 AssignmentExpression 形狀

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

別名:StandardizedExpression


assignmentPattern

JavaScript
t.assignmentPattern(left, right);

另請參閱 t.isAssignmentPattern(node, opts)t.assertAssignmentPattern(node, opts)

AST 節點 AssignmentPattern 形狀

  • left: Identifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression(必要)
  • right: Expression(必要)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(預設值:null,從建立器函數中排除)

別名:StandardizedPatternPatternLikeLVal


awaitExpression

JavaScript
t.awaitExpression(argument);

另請參閱 t.isAwaitExpression(node, opts)t.assertAwaitExpression(node, opts)

AST 節點 AwaitExpression 形狀

  • argument: Expression(必要)

別名:StandardizedExpressionTerminatorless


bigIntLiteral

JavaScript
t.bigIntLiteral(value);

另請參閱 t.isBigIntLiteral(node, opts)t.assertBigIntLiteral(node, opts)

AST 節點 BigIntLiteral 形狀

  • value: string(必要)

別名:StandardizedExpressionPureishLiteralImmutable


binaryExpression

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

另請參閱 t.isBinaryExpression(node, opts)t.assertBinaryExpression(node, opts)

AST 節點 BinaryExpression 形狀

  • 運算子"+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=" | "|>"(必填)
  • 左邊表達式 | 私有名稱(必填)
  • right: Expression(必要)

別名:標準化二元表達式


bindExpression

JavaScript
t.bindExpression(object, callee);

另請參閱 t.isBindExpression(node, opts)t.assertBindExpression(node, opts)

AST 節點 BindExpression 形狀

  • 物件表達式(必填)
  • 呼叫表達式(必填)

別名:表達式


blockStatement

JavaScript
t.blockStatement(body, directives);

另請參閱 t.isBlockStatement(node, opts)t.assertBlockStatement(node, opts)

AST 節點 BlockStatement 形狀

  • 主體陳述式陣列<Statement>(必填)
  • 指令指令陣列<Directive>(預設:[]

別名:標準化可作用域區塊父代區塊陳述式


booleanLiteral

JavaScript
t.booleanLiteral(value);

另請參閱 t.isBooleanLiteral(node, opts)t.assertBooleanLiteral(node, opts)

AST 節點 BooleanLiteral 形狀

  • 布林值(必填)

別名:StandardizedExpressionPureishLiteralImmutable


booleanLiteralTypeAnnotation

JavaScript
t.booleanLiteralTypeAnnotation(value);

另請參閱 t.isBooleanLiteralTypeAnnotation(node, opts)t.assertBooleanLiteralTypeAnnotation(node, opts)

AST 節點 BooleanLiteralTypeAnnotation 形狀

  • 布林值(必填)

別名:FlowFlowType


booleanTypeAnnotation

JavaScript
t.booleanTypeAnnotation();

另請參閱 t.isBooleanTypeAnnotation(node, opts)t.assertBooleanTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


breakStatement

JavaScript
t.breakStatement(label);

另請參閱 t.isBreakStatement(node, opts)t.assertBreakStatement(node, opts)

AST 節點 BreakStatement 形狀

  • label: Identifier (預設值:null)

別名:StandardizedStatementTerminatorlessCompletionStatement


callExpression

JavaScript
t.callExpression(callee, arguments);

另請參閱 t.isCallExpression(node, opts)t.assertCallExpression(node, opts)

AST 節點 CallExpression 形狀

  • callee: Expression | Super | V8IntrinsicIdentifier (必填)
  • arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder> (必填)
  • optional: true | false (預設值:null,從建構函數中排除)
  • typeArguments: TypeParameterInstantiation (預設值:null,從建構函數中排除)
  • typeParameters: TSTypeParameterInstantiation (預設值:null,從建構函數中排除)

別名:StandardizedExpression


catchClause

JavaScript
t.catchClause(param, body);

另請參閱 t.isCatchClause(node, opts)t.assertCatchClause(node, opts)

AST 節點 CatchClause 形狀

  • param: Identifier | ArrayPattern | ObjectPattern (預設值:null)
  • body: BlockStatement(必填)

別名:StandardizedScopableBlockParent


classAccessorProperty

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

另請參閱 t.isClassAccessorProperty(node, opts)t.assertClassAccessorProperty(node, opts)

AST 節點 ClassAccessorProperty 形狀

  • key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName(必填)
  • value: Expression(預設值:null
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop(預設值:null
  • decorators: Array<Decorator>(預設值:null
  • computed: boolean(預設值:false
  • static: boolean(預設值:false
  • abstract: boolean(預設值:null,排除於建構函數之外)
  • accessibility: "public" | "private" | "protected"(預設值:null,排除於建構函數之外)
  • declare: boolean(預設值:null,排除於建構函數之外)
  • definite: boolean(預設值:null,排除於建構函數之外)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • override: boolean(預設值:false,排除於建構函數之外)
  • readonly: boolean(預設值:null,排除於建構函數之外)
  • variance: Variance(預設值:null,排除於建構函數之外)

別名:StandardizedPropertyAccessor


classBody

JavaScript
t.classBody(body);

另請參閱 t.isClassBody(node, opts)t.assertClassBody(node, opts)

AST 節點 ClassBody 形狀

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

別名:Standardized


classDeclaration

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

另請參閱 t.isClassDeclaration(node, opts)t.assertClassDeclaration(node, opts)

AST 節點 ClassDeclaration 形狀

  • id: Identifier (預設值:null)
  • superClass: Expression (預設值:null)
  • body: ClassBody (必填)
  • decorators: Array<Decorator>(預設值:null
  • abstract: boolean(預設值:null,排除於建構函數之外)
  • declare: boolean(預設值:null,排除於建構函數之外)
  • implements: Array<TSExpressionWithTypeArguments | ClassImplements> (預設值:null,從建構函式中排除)
  • mixins: InterfaceExtends (預設值:null,從建構函式中排除)
  • superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (預設值:null,從建構函式中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

別名:StandardizedScopableClassStatementDeclaration


classExpression

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

另請參閱 t.isClassExpression(node, opts)t.assertClassExpression(node, opts)

AST 節點 ClassExpression 形狀

  • id: Identifier (預設值:null)
  • superClass: Expression (預設值:null)
  • body: ClassBody (必填)
  • decorators: Array<Decorator>(預設值:null
  • implements: Array<TSExpressionWithTypeArguments | ClassImplements> (預設值:null,從建構函式中排除)
  • mixins: InterfaceExtends (預設值:null,從建構函式中排除)
  • superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (預設值:null,從建構函式中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

別名:StandardizedScopableClassExpression


classImplements

JavaScript
t.classImplements(id, typeParameters);

另請參閱 t.isClassImplements(node, opts)t.assertClassImplements(node, opts)

AST 節點 ClassImplements 形狀

  • id: Identifier(必填)
  • typeParameters: TypeParameterInstantiation(預設值:null

別名:Flow


classMethod

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

另請參閱 t.isClassMethod(node, opts)t.assertClassMethod(node, opts)

AST 節點 ClassMethod 形狀

  • kind: "get" | "set" | "method" | "constructor"(預設值:'method'
  • key:如果計算後為 Expression,否則為 Identifier | Literal(必填)
  • params: Array<Identifier | Pattern | RestElement | TSParameterProperty>(必填)
  • body: BlockStatement(必填)
  • computed: boolean(預設值:false
  • static: boolean(預設值:false
  • generator: boolean(預設值:false
  • async: boolean(預設:false
  • abstract: boolean(預設值:null,排除於建構函數之外)
  • access: "public" | "private" | "protected"(預設值:null,已從建構函數中排除)
  • accessibility: "public" | "private" | "protected"(預設值:null,排除於建構函數之外)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • override: boolean(預設值:false,排除於建構函數之外)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop(預設:null,從建構函數中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

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


classPrivateMethod

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

另請參閱 t.isClassPrivateMethod(node, opts)t.assertClassPrivateMethod(node, opts)

AST 節點 ClassPrivateMethod 形狀

  • kind: "get" | "set" | "method"(預設值:'method'
  • key: PrivateName(必填)
  • params: Array<Identifier | Pattern | RestElement | TSParameterProperty>(必填)
  • body: BlockStatement(必填)
  • static: boolean(預設值:false
  • abstract: boolean(預設值:null,排除於建構函數之外)
  • access: "public" | "private" | "protected"(預設值:null,已從建構函數中排除)
  • accessibility: "public" | "private" | "protected"(預設值:null,排除於建構函數之外)
  • async: boolean(預設值:false,已從建構函數中排除)
  • computed: 'false'(預設值:false,已從建構函數中排除)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • generator: boolean(預設:false,從建構函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • override: boolean(預設值:false,排除於建構函數之外)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop(預設:null,從建構函數中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

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


classPrivateProperty

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

另請參閱 t.isClassPrivateProperty(node, opts)t.assertClassPrivateProperty(node, opts)

AST 節點 ClassPrivateProperty 形狀

  • key: PrivateName(必填)
  • value: Expression(預設值:null
  • decorators: Array<Decorator>(預設值:null
  • static: boolean(預設值:false
  • definite: boolean(預設值:null,排除於建構函數之外)
  • readonly: boolean(預設值:null,排除於建構函數之外)
  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(預設值:null,從建立器函數中排除)
  • variance: Variance(預設值:null,排除於建構函數之外)

別名:StandardizedPropertyPrivate


classProperty

JavaScript
t.classProperty(key, value, typeAnnotation, decorators, computed, static);
歷史
版本變更
v7.6.0支援 static

另請參閱 t.isClassProperty(node, opts)t.assertClassProperty(node, opts)

AST 節點 ClassProperty 形狀

  • keyIdentifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression(必要)
  • value: Expression(預設值:null
  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop(預設值:null
  • decorators: Array<Decorator>(預設值:null
  • computed: boolean(預設值:false
  • static: boolean(預設值:false
  • abstract: boolean(預設值:null,排除於建構函數之外)
  • accessibility: "public" | "private" | "protected"(預設值:null,排除於建構函數之外)
  • declare: boolean(預設值:null,排除於建構函數之外)
  • definite: boolean(預設值:null,排除於建構函數之外)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • override: boolean(預設值:false,排除於建構函數之外)
  • readonly: boolean(預設值:null,排除於建構函數之外)
  • variance: Variance(預設值:null,排除於建構函數之外)

別名:StandardizedProperty


conditionalExpression

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

另請參閱 t.isConditionalExpression(node, opts)t.assertConditionalExpression(node, opts)

AST 節點 ConditionalExpression 形狀

  • testExpression(必要)
  • consequentExpression(必要)
  • alternateExpression(必要)

別名:StandardizedExpressionConditional


continueStatement

JavaScript
t.continueStatement(label);

另請參閱 t.isContinueStatement(node, opts)t.assertContinueStatement(node, opts)

AST 節點 ContinueStatement 形狀

  • label: Identifier (預設值:null)

別名:StandardizedStatementTerminatorlessCompletionStatement


debuggerStatement

JavaScript
t.debuggerStatement();

另請參閱 t.isDebuggerStatement(node, opts)t.assertDebuggerStatement(node, opts)

別名:StandardizedStatement


decimalLiteral

JavaScript
t.decimalLiteral(value);

另請參閱 t.isDecimalLiteral(node, opts)t.assertDecimalLiteral(node, opts)

AST 節點 DecimalLiteral 形狀

  • value: string(必要)

別名:ExpressionPureishLiteralImmutable


declareClass

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

另請參閱 t.isDeclareClass(node, opts)t.assertDeclareClass(node, opts)

AST 節點 DeclareClass 形狀

  • id: Identifier(必填)
  • typeParametersTypeParameterDeclaration(預設值:null
  • extendsArray<InterfaceExtends>(預設值:null
  • bodyObjectTypeAnnotation(必要)
  • implementsArray<ClassImplements>(預設值:null,從建構函式中排除)
  • mixinsArray<InterfaceExtends>(預設值:null,從建構函式中排除)

別名:FlowFlowDeclarationStatementDeclaration


declareExportAllDeclaration

JavaScript
t.declareExportAllDeclaration(source);

另請參閱 t.isDeclareExportAllDeclaration(node, opts)t.assertDeclareExportAllDeclaration(node, opts)

AST 節點 DeclareExportAllDeclaration 形狀

  • sourceStringLiteral(必要)
  • exportKind"type" | "value"(預設值:null,從建構函式中排除)

別名:FlowFlowDeclarationStatementDeclaration


declareExportDeclaration

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

另請參閱 t.isDeclareExportDeclaration(node, opts)t.assertDeclareExportDeclaration(node, opts)

AST 節點 DeclareExportDeclaration 形狀

  • 宣告流程(預設:null
  • 指定符陣列<匯出指定符 | 匯出命名空間指定符>(預設:null
  • 來源字串文字(預設:null
  • 預設布林值(預設:null,從建構函式中排除)

別名:FlowFlowDeclarationStatementDeclaration


宣告函式

JavaScript
t.declareFunction(id);

另請參閱 t.isDeclareFunction(node, opts)t.assertDeclareFunction(node, opts)

AST 節點 宣告函式 形狀

  • id: Identifier(必填)
  • 謂詞已宣告謂詞(預設:null,從建構函式中排除)

別名:FlowFlowDeclarationStatementDeclaration


宣告介面

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

另請參閱 t.isDeclareInterface(node, opts)t.assertDeclareInterface(node, opts)

AST 節點 宣告介面 形狀

  • id: Identifier(必填)
  • typeParametersTypeParameterDeclaration(預設值:null
  • extendsArray<InterfaceExtends>(預設值:null
  • bodyObjectTypeAnnotation(必要)

別名:FlowFlowDeclarationStatementDeclaration


宣告模組

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

另請參閱 t.isDeclareModule(node, opts)t.assertDeclareModule(node, opts)

AST 節點 宣告模組 形狀

  • 識別碼識別碼 | 字串文字(必要)
  • body: BlockStatement(必填)
  • 種類"CommonJS" | "ES"(預設:null

別名:FlowFlowDeclarationStatementDeclaration


宣告模組匯出

JavaScript
t.declareModuleExports(typeAnnotation);

另請參閱 t.isDeclareModuleExports(node, opts)t.assertDeclareModuleExports(node, opts)

AST 節點 宣告模組匯出 形狀

  • 類型註解類型註解(必要)

別名:FlowFlowDeclarationStatementDeclaration


宣告不透明類型

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

另請參閱 t.isDeclareOpaqueType(node, opts)t.assertDeclareOpaqueType(node, opts)

AST 節點 DeclareOpaqueType 形狀

  • id: Identifier(必填)
  • typeParametersTypeParameterDeclaration(預設值:null
  • supertypeFlowType(預設:null
  • impltypeFlowType(預設:null,從建構函數中排除)

別名:FlowFlowDeclarationStatementDeclaration


declareTypeAlias

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

另請參閱 t.isDeclareTypeAlias(node, opts)t.assertDeclareTypeAlias(node, opts)

AST 節點 DeclareTypeAlias 形狀

  • id: Identifier(必填)
  • typeParametersTypeParameterDeclaration(預設值:null
  • rightFlowType(必要)

別名:FlowFlowDeclarationStatementDeclaration


declareVariable

JavaScript
t.declareVariable(id);

另請參閱 t.isDeclareVariable(node, opts)t.assertDeclareVariable(node, opts)

AST 節點 DeclareVariable 形狀

  • id: Identifier(必填)

別名:FlowFlowDeclarationStatementDeclaration


declaredPredicate

JavaScript
t.declaredPredicate(value);

另請參閱 t.isDeclaredPredicate(node, opts)t.assertDeclaredPredicate(node, opts)

AST 節點 DeclaredPredicate 形狀

  • valueFlow(必要)

別名:FlowFlowPredicate


decorator

JavaScript
t.decorator(expression);

另請參閱 t.isDecorator(node, opts)t.assertDecorator(node, opts)

AST 節點 Decorator 形狀

  • expressionExpression(必要)

directive

JavaScript
t.directive(value);

另請參閱 t.isDirective(node, opts)t.assertDirective(node, opts)

AST 節點 Directive 形狀

  • valueDirectiveLiteral(必要)

別名:Standardized


指令文字

JavaScript
t.directiveLiteral(value);

另請參閱 t.isDirectiveLiteral(node, opts)t.assertDirectiveLiteral(node, opts)

AST 節點 DirectiveLiteral 形狀

  • value: string(必要)

別名:Standardized


do 表達式

JavaScript
t.doExpression(body, async);

另請參閱 t.isDoExpression(node, opts)t.assertDoExpression(node, opts)

AST 節點 DoExpression 形狀

  • body: BlockStatement(必填)
  • async: boolean(預設:false

別名:表達式


do while 敘述

JavaScript
t.doWhileStatement(test, body);

另請參閱 t.isDoWhileStatement(node, opts)t.assertDoWhileStatement(node, opts)

AST 節點 DoWhileStatement 形狀

  • testExpression(必要)
  • body: 敘述 (必要)

別名:標準化敘述區塊父項迴圈While可設定範圍


空敘述

JavaScript
t.emptyStatement();

另請參閱 t.isEmptyStatement(node, opts)t.assertEmptyStatement(node, opts)

別名:StandardizedStatement


空類型註解

JavaScript
t.emptyTypeAnnotation();

另請參閱 t.isEmptyTypeAnnotation(node, opts)t.assertEmptyTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


列舉布林主體

JavaScript
t.enumBooleanBody(members);

另請參閱 t.isEnumBooleanBody(node, opts)t.assertEnumBooleanBody(node, opts)

AST 節點 EnumBooleanBody 形狀

  • members: 陣列<EnumBooleanMember> (必要)
  • explicitType: 布林 (必要)
  • hasUnknownMembers: 布林 (必要)

別名:Flow列舉主體


enumBooleanMember

JavaScript
t.enumBooleanMember(id);

另請參閱 t.isEnumBooleanMember(node, opts)t.assertEnumBooleanMember(node, opts)

AST 節點 EnumBooleanMember 形狀

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

別名:FlowEnumMember


enumDeclaration

JavaScript
t.enumDeclaration(id, body);

另請參閱 t.isEnumDeclaration(node, opts)t.assertEnumDeclaration(node, opts)

AST 節點 EnumDeclaration 形狀

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

別名:FlowStatementDeclaration


enumDefaultedMember

JavaScript
t.enumDefaultedMember(id);

另請參閱 t.isEnumDefaultedMember(node, opts)t.assertEnumDefaultedMember(node, opts)

AST 節點 EnumDefaultedMember 形狀

  • id: Identifier(必填)

別名:FlowEnumMember


enumNumberBody

JavaScript
t.enumNumberBody(members);

另請參閱 t.isEnumNumberBody(node, opts)t.assertEnumNumberBody(node, opts)

AST 節點 EnumNumberBody 形狀

  • members: Array<EnumNumberMember>(必要)
  • explicitType: 布林 (必要)
  • hasUnknownMembers: 布林 (必要)

別名:Flow列舉主體


enumNumberMember

JavaScript
t.enumNumberMember(id, init);

另請參閱 t.isEnumNumberMember(node, opts)t.assertEnumNumberMember(node, opts)

AST 節點 EnumNumberMember 形狀

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

別名:FlowEnumMember


enumStringBody

JavaScript
t.enumStringBody(members);

另請參閱 t.isEnumStringBody(node, opts)t.assertEnumStringBody(node, opts)

AST 節點 EnumStringBody 形狀

  • members: Array<EnumStringMember | EnumDefaultedMember> (必填)
  • explicitType: 布林 (必要)
  • hasUnknownMembers: 布林 (必要)

別名:Flow列舉主體


enumStringMember

JavaScript
t.enumStringMember(id, init);

另請參閱 t.isEnumStringMember(node, opts)t.assertEnumStringMember(node, opts)

AST 節點 EnumStringMember 形狀

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

別名:FlowEnumMember


enumSymbolBody

JavaScript
t.enumSymbolBody(members);

另請參閱 t.isEnumSymbolBody(node, opts)t.assertEnumSymbolBody(node, opts)

AST 節點 EnumSymbolBody 形狀

  • members: Array<EnumDefaultedMember> (必填)
  • hasUnknownMembers: 布林 (必要)

別名:Flow列舉主體


existsTypeAnnotation

JavaScript
t.existsTypeAnnotation();

另請參閱 t.isExistsTypeAnnotation(node, opts)t.assertExistsTypeAnnotation(node, opts)

別名:FlowFlowType


exportAllDeclaration

JavaScript
t.exportAllDeclaration(source);

另請參閱 t.isExportAllDeclaration(node, opts)t.assertExportAllDeclaration(node, opts)

AST 節點 ExportAllDeclaration 形狀

  • sourceStringLiteral(必要)
  • assertions: Array<ImportAttribute> (預設值:null,從建構函數中排除)
  • attributes: Array<ImportAttribute> (預設值:null,從建構函數中排除)
  • exportKind"type" | "value"(預設值:null,從建構函式中排除)

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


exportDefaultDeclaration

JavaScript
t.exportDefaultDeclaration(declaration);

另請參閱 t.isExportDefaultDeclaration(node, opts)t.assertExportDefaultDeclaration(node, opts)

AST 節點 ExportDefaultDeclaration 形狀

  • declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression(必要)
  • exportKind: "value"(預設:null,從建構函數中排除)

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


exportDefaultSpecifier

JavaScript
t.exportDefaultSpecifier(exported);

另請參閱 t.isExportDefaultSpecifier(node, opts)t.assertExportDefaultSpecifier(node, opts)

AST 節點 ExportDefaultSpecifier 形狀

  • exported: Identifier(必要)

別名:ModuleSpecifier


exportNamedDeclaration

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

另請參閱 t.isExportNamedDeclaration(node, opts)t.assertExportNamedDeclaration(node, opts)

AST 節點 ExportNamedDeclaration 形狀

  • declaration: Declaration(預設:null
  • specifiers: Array<ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier>(預設:[]
  • 來源字串文字(預設:null
  • assertions: Array<ImportAttribute> (預設值:null,從建構函數中排除)
  • attributes: Array<ImportAttribute> (預設值:null,從建構函數中排除)
  • exportKind"type" | "value"(預設值:null,從建構函式中排除)

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


exportNamespaceSpecifier

JavaScript
t.exportNamespaceSpecifier(exported);

另請參閱 t.isExportNamespaceSpecifier(node, opts)t.assertExportNamespaceSpecifier(node, opts)

AST 節點 ExportNamespaceSpecifier 形狀

  • exported: Identifier(必要)

別名:Standardized, ModuleSpecifier


exportSpecifier

JavaScript
t.exportSpecifier(local, exported);

另請參閱 t.isExportSpecifier(node, opts)t.assertExportSpecifier(node, opts)

AST 節點 ExportSpecifier 形狀

  • local: Identifier(必要)
  • exported: Identifier | StringLiteral(必要)
  • exportKind"type" | "value"(預設值:null,從建構函式中排除)

別名:Standardized, ModuleSpecifier


表達式陳述式

JavaScript
t.expressionStatement(expression);

另請參閱 t.isExpressionStatement(node, opts)t.assertExpressionStatement(node, opts)

AST 節點 ExpressionStatement 形狀

  • expressionExpression(必要)

別名:標準化陳述式表達式包裝器


檔案

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

另請參閱 t.isFile(node, opts)t.assertFile(node, opts)

AST 節點 檔案 形狀

  • 程式程式(必要)
  • 註解陣列<註解區塊 | 註解行>(預設:null
  • 符號陣列<任何>(預設:null

別名:Standardized


forIn 陳述式

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

另請參閱 t.isForInStatement(node, opts)t.assertForInStatement(node, opts)

AST 節點 ForInStatement 形狀

  • 變數宣告 | LVal(必要)
  • right: Expression(必要)
  • body: 敘述 (必要)

別名:標準化可作用域陳述式For區塊父迴圈ForX 陳述式


forOf 陳述式

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

另請參閱 t.isForOfStatement(node, opts)t.assertForOfStatement(node, opts)

AST 節點 ForOfStatement 形狀

  • 變數宣告 | LVal(必要)
  • right: Expression(必要)
  • body: 敘述 (必要)
  • await布林(預設:false

別名:標準化可作用域陳述式For區塊父迴圈ForX 陳述式


for 陳述式

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

另請參閱t.isForStatement(node, opts)t.assertForStatement(node, opts)

AST 節點 ForStatement 形狀

  • initVariableDeclaration | Expression(預設值:null
  • testExpression(預設值:null
  • updateExpression(預設值:null
  • body: 敘述 (必要)

別名:StandardizedScopableStatementForBlockParentLoop


functionDeclaration

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

另請參閱t.isFunctionDeclaration(node, opts)t.assertFunctionDeclaration(node, opts)

AST 節點 FunctionDeclaration 形狀

  • id: Identifier (預設值:null)
  • params: Array<Identifier | Pattern | RestElement>(必要)
  • body: BlockStatement(必填)
  • generator: boolean(預設值:false
  • async: boolean(預設:false
  • declare: boolean(預設值:null,排除於建構函數之外)
  • predicate: DeclaredPredicate | InferredPredicate(預設:null,從建構函數中排除)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop(預設:null,從建構函數中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

別名:StandardizedScopableFunctionBlockParentFunctionParentStatementPureishDeclaration


functionExpression

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

另請參閱t.isFunctionExpression(node, opts)t.assertFunctionExpression(node, opts)

AST 節點 FunctionExpression 形狀

  • id: Identifier (預設值:null)
  • params: Array<Identifier | Pattern | RestElement>(必要)
  • body: BlockStatement(必填)
  • generator: boolean(預設值:false
  • async: boolean(預設:false
  • predicate: DeclaredPredicate | InferredPredicate(預設:null,從建構函數中排除)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop(預設:null,從建構函數中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

別名:StandardizedScopableFunctionBlockParentFunctionParentExpressionPureish


functionTypeAnnotation

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

另請參閱t.isFunctionTypeAnnotation(node, opts)t.assertFunctionTypeAnnotation(node, opts)

AST 節點 FunctionTypeAnnotation 形狀

  • typeParametersTypeParameterDeclaration(預設值:null
  • paramsArray<FunctionTypeParam>(必填)
  • restFunctionTypeParam(預設值:null
  • returnTypeFlowType(必填)
  • thisFunctionTypeParam(預設值:null,從建構函式中排除)

別名:FlowFlowType


functionTypeParam

JavaScript
t.functionTypeParam(name, typeAnnotation);

另請參閱 t.isFunctionTypeParam(node, opts)t.assertFunctionTypeParam(node, opts)

AST 節點 FunctionTypeParam 形狀

  • name: Identifier(預設值:null
  • typeAnnotation: FlowType(必要)
  • optionalboolean(預設值:null,從建立器函數中排除)

別名:Flow


genericTypeAnnotation

JavaScript
t.genericTypeAnnotation(id, typeParameters);

另請參閱 t.isGenericTypeAnnotation(node, opts)t.assertGenericTypeAnnotation(node, opts)

AST 節點 GenericTypeAnnotation 形狀

  • id: Identifier | QualifiedTypeIdentifier(必要)
  • typeParameters: TypeParameterInstantiation(預設值:null

別名:FlowFlowType


identifier

JavaScript
t.identifier(name);

另請參閱 t.isIdentifier(node, opts)t.assertIdentifier(node, opts)

AST 節點 Identifier 形狀

  • name: string(必要)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(預設值:null,從建立器函數中排除)

別名:StandardizedExpressionPatternLikeLValTSEntityName


ifStatement

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

另請參閱 t.isIfStatement(node, opts)t.assertIfStatement(node, opts)

AST 節點 IfStatement 形狀

  • testExpression(必要)
  • consequent: Statement(必要)
  • alternate: Statement(預設值:null

別名:StandardizedStatementConditional


import

JavaScript
t.import();

另請參閱 t.isImport(node, opts)t.assertImport(node, opts)

別名:StandardizedExpression


importAttribute

JavaScript
t.importAttribute(key, value);

另見 t.isImportAttribute(node, opts)t.assertImportAttribute(node, opts)

AST 節點 ImportAttribute 形狀

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

importDeclaration

JavaScript
t.importDeclaration(specifiers, source);
歷史
版本變更
v7.20.0支援 module

另見 t.isImportDeclaration(node, opts)t.assertImportDeclaration(node, opts)

AST 節點 ImportDeclaration 形狀

  • specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>(必要)
  • sourceStringLiteral(必要)
  • assertions: Array<ImportAttribute> (預設值:null,從建構函數中排除)
  • attributes: Array<ImportAttribute> (預設值:null,從建構函數中排除)
  • importKind: "type" | "typeof" | "value"(預設:null,從建構函數中排除)
  • module: boolean(預設:null,從建構函數中排除)
  • phase: "source" | "defer"(預設:null,從建構函數中排除)

別名:StandardizedStatementDeclarationImportOrExportDeclaration


importDefaultSpecifier

JavaScript
t.importDefaultSpecifier(local);

另見 t.isImportDefaultSpecifier(node, opts)t.assertImportDefaultSpecifier(node, opts)

AST 節點 ImportDefaultSpecifier 形狀

  • local: Identifier(必要)

別名:Standardized, ModuleSpecifier


importExpression

JavaScript
t.importExpression(source, options);

另見 t.isImportExpression(node, opts)t.assertImportExpression(node, opts)

AST 節點 ImportExpression 形狀

  • source: Expression(必要)
  • options: Expression(預設:null
  • phase: "source" | "defer"(預設:null,從建構函數中排除)

別名:StandardizedExpression


importNamespaceSpecifier

JavaScript
t.importNamespaceSpecifier(local);

另請參閱t.isImportNamespaceSpecifier(node, opts)t.assertImportNamespaceSpecifier(node, opts)

AST 節點 ImportNamespaceSpecifier 形狀

  • local: Identifier(必要)

別名:Standardized, ModuleSpecifier


importSpecifier

JavaScript
t.importSpecifier(local, imported);

另請參閱t.isImportSpecifier(node, opts)t.assertImportSpecifier(node, opts)

AST 節點 ImportSpecifier 形狀

  • local: Identifier(必要)
  • imported: Identifier | StringLiteral(必要)
  • importKind: "type" | "typeof" | "value"(預設:null,從建構函數中排除)

別名:Standardized, ModuleSpecifier


indexedAccessType

JavaScript
t.indexedAccessType(objectType, indexType);

另請參閱t.isIndexedAccessType(node, opts)t.assertIndexedAccessType(node, opts)

AST 節點 IndexedAccessType 形狀

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

別名:FlowFlowType


inferredPredicate

JavaScript
t.inferredPredicate();

另請參閱t.isInferredPredicate(node, opts)t.assertInferredPredicate(node, opts)

別名:FlowFlowPredicate


interfaceDeclaration

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

另請參閱t.isInterfaceDeclaration(node, opts)t.assertInterfaceDeclaration(node, opts)

AST 節點 InterfaceDeclaration 形狀

  • id: Identifier(必填)
  • typeParametersTypeParameterDeclaration(預設值:null
  • extendsArray<InterfaceExtends>(預設值:null
  • bodyObjectTypeAnnotation(必要)

別名:FlowFlowDeclarationStatementDeclaration


interfaceExtends

JavaScript
t.interfaceExtends(id, typeParameters);

另請參閱t.isInterfaceExtends(node, opts)t.assertInterfaceExtends(node, opts)

AST 節點 InterfaceExtends 形狀

  • id: Identifier | QualifiedTypeIdentifier(必要)
  • typeParameters: TypeParameterInstantiation(預設值:null

別名:Flow


interfaceTypeAnnotation

JavaScript
t.interfaceTypeAnnotation(extends, body);

另請參閱t.isInterfaceTypeAnnotation(node, opts)t.assertInterfaceTypeAnnotation(node, opts)

AST 節點 InterfaceTypeAnnotation 形狀

  • extendsArray<InterfaceExtends>(預設值:null
  • bodyObjectTypeAnnotation(必要)

別名:FlowFlowType


interpreterDirective

JavaScript
t.interpreterDirective(value);

另請參閱t.isInterpreterDirective(node, opts)t.assertInterpreterDirective(node, opts)

AST 節點 InterpreterDirective 形狀

  • value: string(必要)

別名:Standardized


intersectionTypeAnnotation

JavaScript
t.intersectionTypeAnnotation(types);

另請參閱t.isIntersectionTypeAnnotation(node, opts)t.assertIntersectionTypeAnnotation(node, opts)

AST 節點 IntersectionTypeAnnotation 形狀

  • types: Array<FlowType>(必要)

別名:FlowFlowType


jsxAttribute

JavaScript
t.jsxAttribute(name, value);

另請參閱t.isJSXAttribute(node, opts)t.assertJSXAttribute(node, opts)

AST 節點 JSXAttribute 形狀

  • name: JSXIdentifier | JSXNamespacedName(必要)
  • value: JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer(預設:null

別名:JSXImmutable


jsxClosingElement

JavaScript
t.jsxClosingElement(name);

另請參閱t.isJSXClosingElement(node, opts)t.assertJSXClosingElement(node, opts)

AST 節點 JSXClosingElement 形狀

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

別名:JSXImmutable


jsxClosingFragment

JavaScript
t.jsxClosingFragment();

另請參閱t.isJSXClosingFragment(node, opts)t.assertJSXClosingFragment(node, opts)

別名:JSXImmutable


jsxElement

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

另請參閱t.isJSXElement(node, opts)t.assertJSXElement(node, opts)

AST 節點 JSXElement 形狀

  • openingElement: JSXOpeningElement(必要)
  • closingElement: JSXClosingElement(預設:null
  • children: Array<JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment>(必填)
  • selfClosing: boolean(預設值:null

別名:JSXImmutableExpression


jsxEmptyExpression

JavaScript
t.jsxEmptyExpression();

另請參閱 t.isJSXEmptyExpression(node, opts)t.assertJSXEmptyExpression(node, opts)

別名:JSX


jsxExpressionContainer

JavaScript
t.jsxExpressionContainer(expression);

另請參閱 t.isJSXExpressionContainer(node, opts)t.assertJSXExpressionContainer(node, opts)

AST 節點 JSXExpressionContainer 形狀

  • expression: Expression | JSXEmptyExpression(必填)

別名:JSXImmutable


jsxFragment

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

另請參閱 t.isJSXFragment(node, opts)t.assertJSXFragment(node, opts)

AST 節點 JSXFragment 形狀

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

別名:JSXImmutableExpression


jsxIdentifier

JavaScript
t.jsxIdentifier(name);

另請參閱 t.isJSXIdentifier(node, opts)t.assertJSXIdentifier(node, opts)

AST 節點 JSXIdentifier 形狀

  • name: string(必要)

別名:JSX


jsxMemberExpression

JavaScript
t.jsxMemberExpression(object, property);

另請參閱 t.isJSXMemberExpression(node, opts)t.assertJSXMemberExpression(node, opts)

AST 節點 JSXMemberExpression 形狀

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

別名:JSX


jsxNamespacedName

JavaScript
t.jsxNamespacedName(namespace, name);

另請參閱 t.isJSXNamespacedName(node, opts)t.assertJSXNamespacedName(node, opts)

AST 節點 JSXNamespacedName 形狀

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

別名:JSX


jsxOpeningElement

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

另請參閱 t.isJSXOpeningElement(node, opts)t.assertJSXOpeningElement(node, opts)

AST 節點 JSXOpeningElement 形狀

  • name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName(必要)
  • attributes: Array<JSXAttribute | JSXSpreadAttribute>(必要)
  • selfClosing: boolean(預設值:false
  • typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation(預設值:null,從建構函數中排除)

別名:JSXImmutable


jsxOpeningFragment

JavaScript
t.jsxOpeningFragment();

另請參閱 t.isJSXOpeningFragment(node, opts)t.assertJSXOpeningFragment(node, opts)

別名:JSXImmutable


jsxSpreadAttribute

JavaScript
t.jsxSpreadAttribute(argument);

另請參閱 t.isJSXSpreadAttribute(node, opts)t.assertJSXSpreadAttribute(node, opts)

AST 節點 JSXSpreadAttribute 形狀

  • argument: Expression(必要)

別名:JSX


jsxSpreadChild

JavaScript
t.jsxSpreadChild(expression);

另請參閱 t.isJSXSpreadChild(node, opts)t.assertJSXSpreadChild(node, opts)

AST 節點 JSXSpreadChild 形狀

  • expressionExpression(必要)

別名:JSXImmutable


jsxText

JavaScript
t.jsxText(value);

另請參閱 t.isJSXText(node, opts)t.assertJSXText(node, opts)

AST 節點 JSXText 形狀

  • value: string(必要)

別名:JSXImmutable


labeledStatement

JavaScript
t.labeledStatement(label, body);

另請參閱 t.isLabeledStatement(node, opts)t.assertLabeledStatement(node, opts)

AST 節點 LabeledStatement 形狀

  • 標籤識別碼(必填)
  • body: 敘述 (必要)

別名:StandardizedStatement


logicalExpression

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

另請參閱 t.isLogicalExpression(node, opts)t.assertLogicalExpression(node, opts)

AST 節點 LogicalExpression 形狀

  • 運算子"||" | "&&" | "??"(必填)
  • 表達式(必填)
  • right: Expression(必要)

別名:標準化二元表達式


memberExpression

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

另請參閱 t.isMemberExpression(node, opts)t.assertMemberExpression(node, opts)

AST 節點 MemberExpression 形狀

  • 物件表達式 | 超級(必填)
  • 屬性:如果是運算,則為 表達式,否則為 識別碼(必填)
  • computed: boolean(預設值:false
  • 可選true | false(預設:null

別名:標準化表達式LVal


metaProperty

JavaScript
t.metaProperty(meta, property);

另請參閱 t.isMetaProperty(node, opts)t.assertMetaProperty(node, opts)

AST 節點 MetaProperty 形狀

  • 識別碼(必填)
  • 屬性識別碼(必填)

別名:StandardizedExpression


mixedTypeAnnotation

JavaScript
t.mixedTypeAnnotation();

另請參閱 t.isMixedTypeAnnotation(node, opts)t.assertMixedTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


moduleExpression

JavaScript
t.moduleExpression(body);

另請參閱 t.isModuleExpression(node, opts)t.assertModuleExpression(node, opts)

AST 節點 ModuleExpression 形狀

  • bodyProgram(必要)

別名:表達式


newExpression

JavaScript
t.newExpression(callee, arguments);

另請參閱 t.isNewExpression(node, opts)t.assertNewExpression(node, opts)

AST 節點 NewExpression 形狀

  • callee: Expression | Super | V8IntrinsicIdentifier (必填)
  • arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder> (必填)
  • optional: true | false (預設值:null,從建構函數中排除)
  • typeArguments: TypeParameterInstantiation (預設值:null,從建構函數中排除)
  • typeParameters: TSTypeParameterInstantiation (預設值:null,從建構函數中排除)

別名:StandardizedExpression


noop

JavaScript
t.noop();

另請參閱 t.isNoop(node, opts)t.assertNoop(node, opts)

別名:Miscellaneous


nullLiteral

JavaScript
t.nullLiteral();

另請參閱 t.isNullLiteral(node, opts)t.assertNullLiteral(node, opts)

別名:StandardizedExpressionPureishLiteralImmutable


nullLiteralTypeAnnotation

JavaScript
t.nullLiteralTypeAnnotation();

另請參閱 t.isNullLiteralTypeAnnotation(node, opts)t.assertNullLiteralTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


nullableTypeAnnotation

JavaScript
t.nullableTypeAnnotation(typeAnnotation);

另請參閱 t.isNullableTypeAnnotation(node, opts)t.assertNullableTypeAnnotation(node, opts)

AST 節點 NullableTypeAnnotation 形狀

  • typeAnnotation: FlowType(必要)

別名:FlowFlowType


numberLiteralTypeAnnotation

JavaScript
t.numberLiteralTypeAnnotation(value);

另請參閱 t.isNumberLiteralTypeAnnotation(node, opts)t.assertNumberLiteralTypeAnnotation(node, opts)

AST 節點 NumberLiteralTypeAnnotation 形狀

  • valuenumber(必填)

別名:FlowFlowType


numberTypeAnnotation

JavaScript
t.numberTypeAnnotation();

另請參閱 t.isNumberTypeAnnotation(node, opts)t.assertNumberTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


numericLiteral

JavaScript
t.numericLiteral(value);

另請參閱 t.isNumericLiteral(node, opts)t.assertNumericLiteral(node, opts)

AST 節點 NumericLiteral 形狀

  • value:非負有限 number(必填)

別名:StandardizedExpressionPureishLiteralImmutable


objectExpression

JavaScript
t.objectExpression(properties);

另請參閱 t.isObjectExpression(node, opts)t.assertObjectExpression(node, opts)

AST 節點 ObjectExpression 形狀

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

別名:StandardizedExpression


objectMethod

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

另請參閱 t.isObjectMethod(node, opts)t.assertObjectMethod(node, opts)

AST 節點 ObjectMethod 形狀

  • kind"method" | "get" | "set"(預設:'method'
  • key:如果計算後為 Expression,否則為 Identifier | Literal(必填)
  • params: Array<Identifier | Pattern | RestElement>(必要)
  • body: BlockStatement(必填)
  • computed: boolean(預設值:false
  • generator: boolean(預設值:false
  • async: boolean(預設:false
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • returnType: TypeAnnotation | TSTypeAnnotation | Noop(預設:null,從建構函數中排除)
  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop(預設:null,從建構函數中排除)

別名:StandardizedUserWhitespacableFunctionScopableBlockParentFunctionParentMethodObjectMember


objectPattern

JavaScript
t.objectPattern(properties);

另請參閱 t.isObjectPattern(node, opts)t.assertObjectPattern(node, opts)

AST 節點 ObjectPattern 形狀

  • propertiesArray<RestElement | ObjectProperty>(必要)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(預設值:null,從建立器函數中排除)

別名:StandardizedPatternPatternLikeLVal


objectProperty

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

另請參閱 t.isObjectProperty(node, opts)t.assertObjectProperty(node, opts)

AST 節點 ObjectProperty 形狀

  • key:如果計算後為 Expression,否則為 Identifier | Literal(必填)
  • valueExpression | PatternLike(必要)
  • computed: boolean(預設值:false
  • shorthandboolean(預設:false
  • decorators: Array<Decorator>(預設值:null

別名:StandardizedUserWhitespacablePropertyObjectMember


objectTypeAnnotation

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

另請參閱 t.isObjectTypeAnnotation(node, opts)t.assertObjectTypeAnnotation(node, opts)

AST 節點 ObjectTypeAnnotation 形狀

  • propertiesArray<ObjectTypeProperty | ObjectTypeSpreadProperty>(必要)
  • indexersArray<ObjectTypeIndexer>(預設:[]
  • callPropertiesArray<ObjectTypeCallProperty>(預設:[]
  • internalSlotsArray<ObjectTypeInternalSlot>(預設:[]
  • exactboolean(預設:false
  • inexactboolean(預設:null,排除在建構函數之外)

別名:FlowFlowType


objectTypeCallProperty

JavaScript
t.objectTypeCallProperty(value);

另請參閱 t.isObjectTypeCallProperty(node, opts)t.assertObjectTypeCallProperty(node, opts)

AST 節點 ObjectTypeCallProperty 形狀

  • valueFlowType(必要)
  • staticboolean(必要)

別名:FlowUserWhitespacable


objectTypeIndexer

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

另請參閱 t.isObjectTypeIndexer(node, opts)t.assertObjectTypeIndexer(node, opts)

AST 節點 ObjectTypeIndexer 形狀

  • id: Identifier (預設值:null)
  • keyFlowType(必要)
  • valueFlowType(必要)
  • varianceVariance(預設:null
  • staticboolean(必要)

別名:FlowUserWhitespacable


objectTypeInternalSlot

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

另請參閱 t.isObjectTypeInternalSlot(node, opts)t.assertObjectTypeInternalSlot(node, opts)

AST 節點 ObjectTypeInternalSlot 形狀

  • id: Identifier(必填)
  • valueFlowType(必要)
  • optionalboolean(必要)
  • staticboolean(必要)
  • methodboolean(必要)

別名:FlowUserWhitespacable


objectTypeProperty

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

另請參閱 t.isObjectTypeProperty(node, opts)t.assertObjectTypeProperty(node, opts)

AST 節點 ObjectTypeProperty 形狀

  • key: Identifier | StringLiteral(必要)
  • valueFlowType(必要)
  • varianceVariance(預設:null
  • kind"init" | "get" | "set"(必要)
  • methodboolean(必要)
  • optionalboolean(必要)
  • protoboolean(必要)
  • staticboolean(必要)

別名:FlowUserWhitespacable


objectTypeSpreadProperty

JavaScript
t.objectTypeSpreadProperty(argument);

另請參閱 t.isObjectTypeSpreadProperty(node, opts)t.assertObjectTypeSpreadProperty(node, opts)

AST 節點 ObjectTypeSpreadProperty 形狀

  • argumentFlowType(必要)

別名:FlowUserWhitespacable


opaqueType

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

另請參閱 t.isOpaqueType(node, opts)t.assertOpaqueType(node, opts)

AST 節點 OpaqueType 形狀

  • id: Identifier(必填)
  • typeParametersTypeParameterDeclaration(預設值:null
  • supertypeFlowType(預設:null
  • impltype: FlowType(必要)

別名:FlowFlowDeclarationStatementDeclaration


optionalCallExpression

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

另請參閱 t.isOptionalCallExpression(node, opts)t.assertOptionalCallExpression(node, opts)

AST 節點 OptionalCallExpression 形狀

  • 呼叫表達式(必填)
  • arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder> (必填)
  • optionalboolean(必要)
  • typeArguments: TypeParameterInstantiation (預設值:null,從建構函數中排除)
  • typeParameters: TSTypeParameterInstantiation (預設值:null,從建構函數中排除)

別名:StandardizedExpression


optionalIndexedAccessType

JavaScript
t.optionalIndexedAccessType(objectType, indexType);

另請參閱 t.isOptionalIndexedAccessType(node, opts)t.assertOptionalIndexedAccessType(node, opts)

AST 節點 OptionalIndexedAccessType 形狀

  • objectType: FlowType(必要)
  • indexType: FlowType(必要)
  • optionalboolean(必要)

別名:FlowFlowType


optionalMemberExpression

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

另請參閱 t.isOptionalMemberExpression(node, opts)t.assertOptionalMemberExpression(node, opts)

AST 節點 OptionalMemberExpression 形狀

  • 物件表達式(必填)
  • property: Expression | Identifier(必要)
  • computed: boolean(預設值:false
  • optionalboolean(必要)

別名:StandardizedExpression


parenthesizedExpression

JavaScript
t.parenthesizedExpression(expression);

另請參閱 t.isParenthesizedExpression(node, opts)t.assertParenthesizedExpression(node, opts)

AST 節點 ParenthesizedExpression 形狀

  • expressionExpression(必要)

別名:StandardizedExpressionExpressionWrapper


pipelineBareFunction

JavaScript
t.pipelineBareFunction(callee);

另請參閱 t.isPipelineBareFunction(node, opts)t.assertPipelineBareFunction(node, opts)

AST 節點 PipelineBareFunction 形狀

  • 呼叫表達式(必填)

別名:表達式


pipelinePrimaryTopicReference

JavaScript
t.pipelinePrimaryTopicReference();

另請參閱 t.isPipelinePrimaryTopicReference(node, opts)t.assertPipelinePrimaryTopicReference(node, opts)

別名:表達式


pipelineTopicExpression

JavaScript
t.pipelineTopicExpression(expression);

另請參閱 t.isPipelineTopicExpression(node, opts)t.assertPipelineTopicExpression(node, opts)

AST 節點 PipelineTopicExpression 形狀

  • expressionExpression(必要)

別名:表達式


placeholder

JavaScript
t.placeholder(expectedNode, name);

另請參閱 t.isPlaceholder(node, opts)t.assertPlaceholder(node, opts)

AST 節點 Placeholder 形狀

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

別名:Miscellaneous


privateName

JavaScript
t.privateName(id);

另請參閱 t.isPrivateName(node, opts)t.assertPrivateName(node, opts)

AST 節點 PrivateName 形狀

  • id: Identifier(必填)

別名:StandardizedPrivate


program

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

另請參閱 t.isProgram(node, opts)t.assertProgram(node, opts)

AST 節點 Program 形狀

  • 主體陳述式陣列<Statement>(必填)
  • 指令指令陣列<Directive>(預設:[]
  • sourceType: "script" | "module" (預設值:'script')
  • interpreter: InterpreterDirective (預設值:null)

別名:StandardizedScopableBlockParentBlock


qualifiedTypeIdentifier

JavaScript
t.qualifiedTypeIdentifier(id, qualification);

另請參閱 t.isQualifiedTypeIdentifier(node, opts)t.assertQualifiedTypeIdentifier(node, opts)

AST 節點 QualifiedTypeIdentifier 形狀

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

別名:Flow


recordExpression

JavaScript
t.recordExpression(properties);

另請參閱 t.isRecordExpression(node, opts)t.assertRecordExpression(node, opts)

AST 節點 RecordExpression 形狀

  • properties: Array<ObjectProperty | SpreadElement>(必填)

別名:表達式


regExpLiteral

JavaScript
t.regExpLiteral(pattern, flags);

另請參閱 t.isRegExpLiteral(node, opts)t.assertRegExpLiteral(node, opts)

AST 節點 RegExpLiteral 形狀

  • pattern: string(必填)
  • flags: string(預設值:''

別名:StandardizedExpressionPureishLiteral


restElement

JavaScript
t.restElement(argument);

另請參閱 t.isRestElement(node, opts)t.assertRestElement(node, opts)

AST 節點 RestElement 形狀

  • argument: LVal(必填)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • typeAnnotationTypeAnnotation | TSTypeAnnotation | Noop(預設值:null,從建立器函數中排除)

別名:StandardizedLValPatternLike


returnStatement

JavaScript
t.returnStatement(argument);

另請參閱 t.isReturnStatement(node, opts)t.assertReturnStatement(node, opts)

AST 節點 ReturnStatement 形狀

  • argument: Expression(預設值:null

別名:StandardizedStatementTerminatorlessCompletionStatement


sequenceExpression

JavaScript
t.sequenceExpression(expressions);

另請參閱 t.isSequenceExpression(node, opts)t.assertSequenceExpression(node, opts)

AST 節點 SequenceExpression 形狀

  • expressions: Array<Expression>(必填)

別名:StandardizedExpression


spreadElement

JavaScript
t.spreadElement(argument);

另請參閱 t.isSpreadElement(node, opts)t.assertSpreadElement(node, opts)

AST 節點 SpreadElement 形狀

  • argument: Expression(必要)

別名:StandardizedUnaryLike


staticBlock

JavaScript
t.staticBlock(body);

另請參閱 t.isStaticBlock(node, opts)t.assertStaticBlock(node, opts)

AST 節點 StaticBlock 形狀

  • 主體陳述式陣列<Statement>(必填)

別名:StandardizedScopableBlockParentFunctionParent


stringLiteral

JavaScript
t.stringLiteral(value);

另請參閱 t.isStringLiteral(node, opts)t.assertStringLiteral(node, opts)

AST 節點 StringLiteral 形狀

  • value: string(必要)

別名:StandardizedExpressionPureishLiteralImmutable


stringLiteralTypeAnnotation

JavaScript
t.stringLiteralTypeAnnotation(value);

另請參閱 t.isStringLiteralTypeAnnotation(node, opts)t.assertStringLiteralTypeAnnotation(node, opts)

AST 節點 StringLiteralTypeAnnotation 形狀

  • value: string(必要)

別名:FlowFlowType


stringTypeAnnotation

JavaScript
t.stringTypeAnnotation();

另請參閱 t.isStringTypeAnnotation(node, opts)t.assertStringTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


super

JavaScript
t.super();

另請參閱 t.isSuper(node, opts)t.assertSuper(node, opts)

別名:StandardizedExpression


switchCase

JavaScript
t.switchCase(test, consequent);

另請參閱 t.isSwitchCase(node, opts)t.assertSwitchCase(node, opts)

AST 節點 SwitchCase 形狀

  • testExpression(預設值:null
  • consequent: Array<Statement>(必要)

別名:Standardized


switchStatement

JavaScript
t.switchStatement(discriminant, cases);

另見 t.isSwitchStatement(node, opts)t.assertSwitchStatement(node, opts)

AST 節點 SwitchStatement 形狀

  • discriminant: Expression(必要)
  • cases: Array<SwitchCase>(必要)

別名:StandardizedStatementBlockParentScopable


symbolTypeAnnotation

JavaScript
t.symbolTypeAnnotation();

另見 t.isSymbolTypeAnnotation(node, opts)t.assertSymbolTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


tsAnyKeyword

JavaScript
t.tsAnyKeyword();

另見 t.isTSAnyKeyword(node, opts)t.assertTSAnyKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsArrayType

JavaScript
t.tsArrayType(elementType);

另見 t.isTSArrayType(node, opts)t.assertTSArrayType(node, opts)

AST 節點 TSArrayType 形狀

  • elementType: TSType(必要)

別名:TypeScriptTSType


tsAsExpression

JavaScript
t.tsAsExpression(expression, typeAnnotation);

另見 t.isTSAsExpression(node, opts)t.assertTSAsExpression(node, opts)

AST 節點 TSAsExpression 形狀

  • expressionExpression(必要)
  • typeAnnotation: TSType(必要)

別名:TypeScriptExpressionLValPatternLike


tsBigIntKeyword

JavaScript
t.tsBigIntKeyword();

請參閱 t.isTSBigIntKeyword(node, opts)t.assertTSBigIntKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsBooleanKeyword

JavaScript
t.tsBooleanKeyword();

請參閱 t.isTSBooleanKeyword(node, opts)t.assertTSBooleanKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsCallSignatureDeclaration

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

請參閱 t.isTSCallSignatureDeclaration(node, opts)t.assertTSCallSignatureDeclaration(node, opts)

AST 節點 TSCallSignatureDeclaration 形狀

  • typeParametersTSTypeParameterDeclaration(預設值:null
  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)
  • typeAnnotationTSTypeAnnotation(預設值:null

別名:TypeScriptTSTypeElement


tsConditionalType

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

請參閱 t.isTSConditionalType(node, opts)t.assertTSConditionalType(node, opts)

AST 節點 TSConditionalType 形狀

  • checkTypeTSType(必填)
  • extendsTypeTSType(必填)
  • trueTypeTSType(必填)
  • falseTypeTSType(必填)

別名:TypeScriptTSType


tsConstructSignatureDeclaration

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

請參閱 t.isTSConstructSignatureDeclaration(node, opts)t.assertTSConstructSignatureDeclaration(node, opts)

AST 節點 TSConstructSignatureDeclaration 形狀

  • typeParametersTSTypeParameterDeclaration(預設值:null
  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)
  • typeAnnotationTSTypeAnnotation(預設值:null

別名:TypeScriptTSTypeElement


tsConstructorType

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

另請參閱 t.isTSConstructorType(node, opts)t.assertTSConstructorType(node, opts)

AST 節點 TSConstructorType 形狀

  • typeParametersTSTypeParameterDeclaration(預設值:null
  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)
  • typeAnnotationTSTypeAnnotation(預設值:null
  • abstract: boolean(預設值:null,排除於建構函數之外)

別名:TypeScriptTSType


tsDeclareFunction

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

另請參閱 t.isTSDeclareFunction(node, opts)t.assertTSDeclareFunction(node, opts)

AST 節點 TSDeclareFunction 形狀

  • id: Identifier (預設值:null)
  • typeParameters: TSTypeParameterDeclaration | Noop (預設值:null)
  • params: Array<Identifier | Pattern | RestElement>(必要)
  • returnType: TSTypeAnnotation | Noop (預設值:null)
  • async: boolean(預設值:false,已從建構函數中排除)
  • declare: boolean(預設值:null,排除於建構函數之外)
  • generator: boolean(預設:false,從建構函數中排除)

別名:TypeScriptStatementDeclaration


tsDeclareMethod

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

另請參閱 t.isTSDeclareMethod(node, opts)t.assertTSDeclareMethod(node, opts)

AST 節點 TSDeclareMethod 形狀

  • decorators: Array<Decorator>(預設值:null
  • keyIdentifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression(必要)
  • typeParameters: TSTypeParameterDeclaration | Noop (預設值:null)
  • params: Array<Identifier | Pattern | RestElement | TSParameterProperty>(必填)
  • returnType: TSTypeAnnotation | Noop (預設值:null)
  • abstract: boolean(預設值:null,排除於建構函數之外)
  • access: "public" | "private" | "protected"(預設值:null,已從建構函數中排除)
  • accessibility: "public" | "private" | "protected"(預設值:null,排除於建構函數之外)
  • async: boolean(預設值:false,已從建構函數中排除)
  • computed: boolean (預設值:false,從建構函數中排除)
  • generator: boolean(預設:false,從建構函數中排除)
  • kind: "get" | "set" | "method" | "constructor" (預設值:'method',從建構函數中排除)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • override: boolean(預設值:false,排除於建構函數之外)
  • static: boolean (預設值:false,從建構函數中排除)

別名:TypeScript


tsEnumDeclaration

JavaScript
t.tsEnumDeclaration(id, members);

另請參閱 t.isTSEnumDeclaration(node, opts)t.assertTSEnumDeclaration(node, opts)

AST 節點 TSEnumDeclaration 形狀

  • id: Identifier(必填)
  • members: Array<TSEnumMember> (必要)
  • const: boolean (預設值:null,從建構函數中排除)
  • declare: boolean(預設值:null,排除於建構函數之外)
  • initializer: Expression (預設值:null,從建構函數中排除)

別名:TypeScriptStatementDeclaration


tsEnumMember

JavaScript
t.tsEnumMember(id, initializer);

另請參閱t.isTSEnumMember(node, opts)t.assertTSEnumMember(node, opts)

AST 節點 TSEnumMember 形狀

  • 識別碼識別碼 | 字串文字(必要)
  • initializer: Expression(預設值:null

別名:TypeScript


tsExportAssignment

JavaScript
t.tsExportAssignment(expression);

另請參閱t.isTSExportAssignment(node, opts)t.assertTSExportAssignment(node, opts)

AST 節點 TSExportAssignment 形狀

  • expressionExpression(必要)

別名:TypeScriptStatement


tsExpressionWithTypeArguments

JavaScript
t.tsExpressionWithTypeArguments(expression, typeParameters);

另請參閱t.isTSExpressionWithTypeArguments(node, opts)t.assertTSExpressionWithTypeArguments(node, opts)

AST 節點 TSExpressionWithTypeArguments 形狀

  • expression: TSEntityName(必要)
  • typeParameters: TSTypeParameterInstantiation(預設值:null

別名:TypeScriptTSType


tsExternalModuleReference

JavaScript
t.tsExternalModuleReference(expression);

另請參閱t.isTSExternalModuleReference(node, opts)t.assertTSExternalModuleReference(node, opts)

AST 節點 TSExternalModuleReference 形狀

  • expression: StringLiteral(必要)

別名:TypeScript


tsFunctionType

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

另請參閱t.isTSFunctionType(node, opts)t.assertTSFunctionType(node, opts)

AST 節點 TSFunctionType 形狀

  • typeParametersTSTypeParameterDeclaration(預設值:null
  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)
  • typeAnnotationTSTypeAnnotation(預設值:null

別名:TypeScriptTSType


tsImportEqualsDeclaration

JavaScript
t.tsImportEqualsDeclaration(id, moduleReference);

另請參閱t.isTSImportEqualsDeclaration(node, opts)t.assertTSImportEqualsDeclaration(node, opts)

AST 節點 TSImportEqualsDeclaration 形狀

  • id: Identifier(必填)
  • moduleReference: TSEntityName | TSExternalModuleReference(必要)
  • importKind: "type" | "value"(預設值:null,從建構函數中排除)
  • isExport: boolean(必要)

別名:TypeScriptStatement


tsImportType

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

另請參閱t.isTSImportType(node, opts)t.assertTSImportType(node, opts)

AST 節點 TSImportType 形狀

  • argument: StringLiteral(必填)
  • qualifier: TSEntityName(預設:null
  • typeParameters: TSTypeParameterInstantiation(預設值:null
  • options: Expression(預設:null,從建構函數中排除)

別名:TypeScriptTSType


tsIndexSignature

JavaScript
t.tsIndexSignature(parameters, typeAnnotation);

另請參閱 t.isTSIndexSignature(node, opts)t.assertTSIndexSignature(node, opts)

AST 節點 TSIndexSignature 形狀

  • parameters: Array<Identifier>(必填)
  • typeAnnotationTSTypeAnnotation(預設值:null
  • readonly: boolean(預設值:null,排除於建構函數之外)
  • static: boolean(預設:null,從建構函數中排除)

別名:TypeScriptTSTypeElement


tsIndexedAccessType

JavaScript
t.tsIndexedAccessType(objectType, indexType);

另請參閱 t.isTSIndexedAccessType(node, opts)t.assertTSIndexedAccessType(node, opts)

AST 節點 TSIndexedAccessType 形狀

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

別名:TypeScriptTSType


tsInferType

JavaScript
t.tsInferType(typeParameter);

另請參閱 t.isTSInferType(node, opts)t.assertTSInferType(node, opts)

AST 節點 TSInferType 形狀

  • typeParameter: TSTypeParameter(必填)

別名:TypeScriptTSType


tsInstantiationExpression

JavaScript
t.tsInstantiationExpression(expression, typeParameters);

另請參閱 t.isTSInstantiationExpression(node, opts)t.assertTSInstantiationExpression(node, opts)

AST 節點 TSInstantiationExpression 形狀

  • expressionExpression(必要)
  • typeParameters: TSTypeParameterInstantiation(預設值:null

別名:TypeScriptExpression


tsInterfaceBody

JavaScript
t.tsInterfaceBody(body);

另請參閱t.isTSInterfaceBody(node, opts)t.assertTSInterfaceBody(node, opts)

AST 節點 TSInterfaceBody 形狀

  • body: Array<TSTypeElement>(必要)

別名:TypeScript


tsInterfaceDeclaration

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

另請參閱t.isTSInterfaceDeclaration(node, opts)t.assertTSInterfaceDeclaration(node, opts)

AST 節點 TSInterfaceDeclaration 形狀

  • id: Identifier(必填)
  • typeParametersTSTypeParameterDeclaration(預設值:null
  • extends: Array<TSExpressionWithTypeArguments>(預設:null
  • body: TSInterfaceBody(必要)
  • declare: boolean(預設值:null,排除於建構函數之外)

別名:TypeScriptStatementDeclaration


tsIntersectionType

JavaScript
t.tsIntersectionType(types);

另請參閱t.isTSIntersectionType(node, opts)t.assertTSIntersectionType(node, opts)

AST 節點 TSIntersectionType 形狀

  • types: Array<TSType>(必要)

別名:TypeScriptTSType


tsIntrinsicKeyword

JavaScript
t.tsIntrinsicKeyword();

另請參閱t.isTSIntrinsicKeyword(node, opts)t.assertTSIntrinsicKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsLiteralType

JavaScript
t.tsLiteralType(literal);

另請參閱t.isTSLiteralType(node, opts)t.assertTSLiteralType(node, opts)

AST 節點 TSLiteralType 形狀

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

別名:TypeScriptTSTypeTSBaseType


tsMappedType

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

另請參閱t.isTSMappedType(node, opts)t.assertTSMappedType(node, opts)

AST 節點 TSMappedType 形狀

  • typeParameter: TSTypeParameter(必填)
  • typeAnnotation: TSType(預設:null
  • nameType: TSType(預設:null
  • optional: true | false | "+" | "-"(預設:null,從建構函式中排除)
  • readonly: true | false | "+" | "-"(預設:null,從建構函式中排除)

別名:TypeScriptTSType


tsMethodSignature

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

另請參閱 t.isTSMethodSignature(node, opts)t.assertTSMethodSignature(node, opts)

AST 節點 TSMethodSignature 形狀

  • key: Expression(必填)
  • typeParametersTSTypeParameterDeclaration(預設值:null
  • parametersArray<ArrayPattern | Identifier | ObjectPattern | RestElement>(必填)
  • typeAnnotationTSTypeAnnotation(預設值:null
  • computed: boolean (預設值:false,從建構函數中排除)
  • kind: "method" | "get" | "set"(必填)
  • optionalboolean(預設值:null,從建立器函數中排除)

別名:TypeScriptTSTypeElement


tsModuleBlock

JavaScript
t.tsModuleBlock(body);

另請參閱 t.isTSModuleBlock(node, opts)t.assertTSModuleBlock(node, opts)

AST 節點 TSModuleBlock 形狀

  • 主體陳述式陣列<Statement>(必填)

別名:TypeScriptScopableBlockBlockParentFunctionParent


tsModuleDeclaration

JavaScript
t.tsModuleDeclaration(id, body);

另請參閱 t.isTSModuleDeclaration(node, opts)t.assertTSModuleDeclaration(node, opts)

AST 節點 TSModuleDeclaration 形狀

  • 識別碼識別碼 | 字串文字(必要)
  • body: TSModuleBlock | TSModuleDeclaration(必填)
  • declare: boolean(預設值:null,排除於建構函數之外)
  • global: boolean(預設:null,排除在建構函式外)

別名:TypeScriptStatementDeclaration


tsNamedTupleMember

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

另請參閱 t.isTSNamedTupleMember(node, opts)t.assertTSNamedTupleMember(node, opts)

AST 節點 TSNamedTupleMember 形狀

  • 標籤識別碼(必填)
  • elementType: TSType(必要)
  • optional: boolean(預設:false

別名:TypeScript


tsNamespaceExportDeclaration

JavaScript
t.tsNamespaceExportDeclaration(id);

另請參閱 t.isTSNamespaceExportDeclaration(node, opts)t.assertTSNamespaceExportDeclaration(node, opts)

AST 節點 TSNamespaceExportDeclaration 形狀

  • id: Identifier(必填)

別名:TypeScriptStatement


tsNeverKeyword

JavaScript
t.tsNeverKeyword();

另請參閱 t.isTSNeverKeyword(node, opts)t.assertTSNeverKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsNonNullExpression

JavaScript
t.tsNonNullExpression(expression);

另請參閱 t.isTSNonNullExpression(node, opts)t.assertTSNonNullExpression(node, opts)

AST 節點 TSNonNullExpression 形狀

  • expressionExpression(必要)

別名:TypeScriptExpressionLValPatternLike


tsNullKeyword

JavaScript
t.tsNullKeyword();

另請參閱 t.isTSNullKeyword(node, opts)t.assertTSNullKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsNumberKeyword

JavaScript
t.tsNumberKeyword();

另請參閱 t.isTSNumberKeyword(node, opts)t.assertTSNumberKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsObjectKeyword

JavaScript
t.tsObjectKeyword();

另請參閱 t.isTSObjectKeyword(node, opts)t.assertTSObjectKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsOptionalType

JavaScript
t.tsOptionalType(typeAnnotation);

另請參閱 t.isTSOptionalType(node, opts)t.assertTSOptionalType(node, opts)

AST 節點 TSOptionalType 形狀

  • typeAnnotation: TSType(必要)

別名:TypeScriptTSType


tsParameterProperty

JavaScript
t.tsParameterProperty(parameter);

另請參閱 t.isTSParameterProperty(node, opts)t.assertTSParameterProperty(node, opts)

AST 節點 TSParameterProperty 形狀

  • parameter: Identifier | AssignmentPattern(必填)
  • accessibility: "public" | "private" | "protected"(預設值:null,排除於建構函數之外)
  • decoratorsArray<Decorator>(預設值:null,從建立器函數中排除)
  • override: boolean(預設值:null,從建構函數中排除)
  • readonly: boolean(預設值:null,排除於建構函數之外)

別名:TypeScriptLVal


tsParenthesizedType

JavaScript
t.tsParenthesizedType(typeAnnotation);

另請參閱 t.isTSParenthesizedType(node, opts)t.assertTSParenthesizedType(node, opts)

AST 節點 TSParenthesizedType 形狀

  • typeAnnotation: TSType(必要)

別名:TypeScriptTSType


tsPropertySignature

JavaScript
t.tsPropertySignature(key, typeAnnotation);

另請參閱 t.isTSPropertySignature(node, opts)t.assertTSPropertySignature(node, opts)

AST 節點 TSPropertySignature 形狀

  • key: Expression(必填)
  • typeAnnotationTSTypeAnnotation(預設值:null
  • computed: boolean (預設值:false,從建構函數中排除)
  • kind: "get" | "set"(必需)
  • optionalboolean(預設值:null,從建立器函數中排除)
  • readonly: boolean(預設值:null,排除於建構函數之外)

別名:TypeScriptTSTypeElement


tsQualifiedName

JavaScript
t.tsQualifiedName(left, right);

另請參閱 t.isTSQualifiedName(node, opts)t.assertTSQualifiedName(node, opts)

AST 節點 TSQualifiedName 形狀

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

別名:TypeScriptTSEntityName


tsRestType

JavaScript
t.tsRestType(typeAnnotation);

另請參閱 t.isTSRestType(node, opts)t.assertTSRestType(node, opts)

AST 節點 TSRestType 形狀

  • typeAnnotation: TSType(必要)

別名:TypeScriptTSType


tsSatisfiesExpression

JavaScript
t.tsSatisfiesExpression(expression, typeAnnotation);
歷史
版本變更
v7.20.0已引入

另請參閱 t.isTSSatisfiesExpression(node, opts)t.assertTSSatisfiesExpression(node, opts)

AST 節點 TSSatisfiesExpression 形狀

  • expressionExpression(必要)
  • typeAnnotation: TSType(必要)

別名:TypeScriptExpressionLValPatternLike


tsStringKeyword

JavaScript
t.tsStringKeyword();

另請參閱 t.isTSStringKeyword(node, opts)t.assertTSStringKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsSymbolKeyword

JavaScript
t.tsSymbolKeyword();

另請參閱 t.isTSSymbolKeyword(node, opts)t.assertTSSymbolKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsThisType

JavaScript
t.tsThisType();

另請參閱 t.isTSThisType(node, opts)t.assertTSThisType(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsTupleType

JavaScript
t.tsTupleType(elementTypes);

另請參閱 t.isTSTupleType(node, opts)t.assertTSTupleType(node, opts)

AST 節點 TSTupleType 形狀

  • elementTypes: Array<TSType | TSNamedTupleMember>(必要)

別名:TypeScriptTSType


tsTypeAliasDeclaration

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

另請參閱 t.isTSTypeAliasDeclaration(node, opts)t.assertTSTypeAliasDeclaration(node, opts)

AST 節點 TSTypeAliasDeclaration 形狀

  • id: Identifier(必填)
  • typeParametersTSTypeParameterDeclaration(預設值:null
  • typeAnnotation: TSType(必要)
  • declare: boolean(預設值:null,排除於建構函數之外)

別名:TypeScriptStatementDeclaration


tsTypeAnnotation

JavaScript
t.tsTypeAnnotation(typeAnnotation);

另請參閱 t.isTSTypeAnnotation(node, opts)t.assertTSTypeAnnotation(node, opts)

AST 節點 TSTypeAnnotation 形狀

  • typeAnnotation: TSType(必要)

別名:TypeScript


tsTypeAssertion

JavaScript
t.tsTypeAssertion(typeAnnotation, expression);

另請參閱 t.isTSTypeAssertion(node, opts)t.assertTSTypeAssertion(node, opts)

AST 節點 TSTypeAssertion 形狀

  • typeAnnotation: TSType(必要)
  • expressionExpression(必要)

別名:TypeScriptExpressionLValPatternLike


tsTypeLiteral

JavaScript
t.tsTypeLiteral(members);

另請參閱 t.isTSTypeLiteral(node, opts)t.assertTSTypeLiteral(node, opts)

AST 節點 TSTypeLiteral 形狀

  • members: Array<TSTypeElement>(必要)

別名:TypeScriptTSType


tsTypeOperator

JavaScript
t.tsTypeOperator(typeAnnotation);

另請參閱 t.isTSTypeOperator(node, opts)t.assertTSTypeOperator(node, opts)

AST 節點 TSTypeOperator 形狀

  • typeAnnotation: TSType(必要)
  • operator: string(必要)

別名:TypeScriptTSType


tsTypeParameter

JavaScript
t.tsTypeParameter(constraint, default, name);
歷史
版本變更
v7.21.0支援 const

另請參閱 t.isTSTypeParameter(node, opts)t.assertTSTypeParameter(node, opts)

AST 節點 TSTypeParameter 形狀

  • constraint: TSType (預設:null)
  • default: TSType (預設:null)
  • name: string(必要)
  • const: boolean (預設值:null,從建構函數中排除)
  • in: boolean (預設:null,排除在建構函數之外)
  • out: boolean (預設:null,排除在建構函數之外)

別名:TypeScript


tsTypeParameterDeclaration

JavaScript
t.tsTypeParameterDeclaration(params);

另請參閱 t.isTSTypeParameterDeclaration(node, opts)t.assertTSTypeParameterDeclaration(node, opts)

AST 節點 TSTypeParameterDeclaration 形狀

  • params: Array<TSTypeParameter> (必要)

別名:TypeScript


tsTypeParameterInstantiation

JavaScript
t.tsTypeParameterInstantiation(params);

另請參閱 t.isTSTypeParameterInstantiation(node, opts)t.assertTSTypeParameterInstantiation(node, opts)

AST 節點 TSTypeParameterInstantiation 形狀

  • params: Array<TSType> (必要)

別名:TypeScript


tsTypePredicate

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

另請參閱 t.isTSTypePredicate(node, opts)t.assertTSTypePredicate(node, opts)

AST 節點 TSTypePredicate 形狀

  • parameterName: Identifier | TSThisType (必要)
  • typeAnnotationTSTypeAnnotation(預設值:null
  • asserts: boolean (預設:null)

別名:TypeScriptTSType


tsTypeQuery

JavaScript
t.tsTypeQuery(exprName, typeParameters);

另請參閱 t.isTSTypeQuery(node, opts)t.assertTSTypeQuery(node, opts)

AST 節點 TSTypeQuery 形狀

  • exprName: TSEntityName | TSImportType (必要)
  • typeParameters: TSTypeParameterInstantiation(預設值:null

別名:TypeScriptTSType


tsTypeReference

JavaScript
t.tsTypeReference(typeName, typeParameters);

另請參閱 t.isTSTypeReference(node, opts)t.assertTSTypeReference(node, opts)

AST 節點 TSTypeReference 形狀

  • typeName: TSEntityName(必要)
  • typeParameters: TSTypeParameterInstantiation(預設值:null

別名:TypeScriptTSType


tsUndefinedKeyword

JavaScript
t.tsUndefinedKeyword();

另請參閱 t.isTSUndefinedKeyword(node, opts)t.assertTSUndefinedKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsUnionType

JavaScript
t.tsUnionType(types);

另請參閱 t.isTSUnionType(node, opts)t.assertTSUnionType(node, opts)

AST 節點 TSUnionType 形狀

  • types: Array<TSType>(必要)

別名:TypeScriptTSType


tsUnknownKeyword

JavaScript
t.tsUnknownKeyword();

另請參閱 t.isTSUnknownKeyword(node, opts)t.assertTSUnknownKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


tsVoidKeyword

JavaScript
t.tsVoidKeyword();

另請參閱 t.isTSVoidKeyword(node, opts)t.assertTSVoidKeyword(node, opts)

別名:TypeScriptTSTypeTSBaseType


taggedTemplateExpression

JavaScript
t.taggedTemplateExpression(tag, quasi);

另請參閱 t.isTaggedTemplateExpression(node, opts)t.assertTaggedTemplateExpression(node, opts)

AST 節點 TaggedTemplateExpression 形狀

  • tag: Expression(必要)
  • quasi: TemplateLiteral(必要)
  • typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation(預設值:null,從建構函數中排除)

別名:StandardizedExpression


templateElement

JavaScript
t.templateElement(value, tail);

另請參閱 t.isTemplateElement(node, opts)t.assertTemplateElement(node, opts)

AST 節點 TemplateElement 形狀

  • value: { raw: string, cooked?: string }(必要)
  • tail: 布林值(預設值:false

別名:Standardized


templateLiteral

JavaScript
t.templateLiteral(quasis, expressions);

另請參閱 t.isTemplateLiteral(node, opts)t.assertTemplateLiteral(node, opts)

AST 節點 TemplateLiteral 形狀

  • quasis: 陣列<TemplateElement>(必要)
  • expressions: 陣列<Expression | TSType>(必要)

別名:標準化表達式文字


thisExpression

JavaScript
t.thisExpression();

另請參閱 t.isThisExpression(node, opts)t.assertThisExpression(node, opts)

別名:StandardizedExpression


thisTypeAnnotation

JavaScript
t.thisTypeAnnotation();

另請參閱 t.isThisTypeAnnotation(node, opts)t.assertThisTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


throwStatement

JavaScript
t.throwStatement(argument);

另請參閱 t.isThrowStatement(node, opts)t.assertThrowStatement(node, opts)

AST 節點 ThrowStatement 形狀

  • argument: Expression(必要)

別名:StandardizedStatementTerminatorlessCompletionStatement


topicReference

JavaScript
t.topicReference();

另請參閱 t.isTopicReference(node, opts)t.assertTopicReference(node, opts)

別名:表達式


tryStatement

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

另請參閱 t.isTryStatement(node, opts)t.assertTryStatement(node, opts)

AST 節點 TryStatement 形狀

  • block: BlockStatement(必要)
  • handler: CatchClause(預設值:null
  • finalizerBlockStatement(預設:null

別名:StandardizedStatement


tupleExpression

JavaScript
t.tupleExpression(elements);

另請參閱 t.isTupleExpression(node, opts)t.assertTupleExpression(node, opts)

AST 節點 TupleExpression 形狀

  • elementsArray<Expression | SpreadElement>(預設:[]

別名:表達式


tupleTypeAnnotation

JavaScript
t.tupleTypeAnnotation(types);

另請參閱 t.isTupleTypeAnnotation(node, opts)t.assertTupleTypeAnnotation(node, opts)

AST 節點 TupleTypeAnnotation 形狀

  • types: Array<FlowType>(必要)

別名:FlowFlowType


typeAlias

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

另請參閱 t.isTypeAlias(node, opts)t.assertTypeAlias(node, opts)

AST 節點 TypeAlias 形狀

  • id: Identifier(必填)
  • typeParametersTypeParameterDeclaration(預設值:null
  • rightFlowType(必要)

別名:FlowFlowDeclarationStatementDeclaration


typeAnnotation

JavaScript
t.typeAnnotation(typeAnnotation);

另請參閱 t.isTypeAnnotation(node, opts)t.assertTypeAnnotation(node, opts)

AST 節點 TypeAnnotation 形狀

  • typeAnnotation: FlowType(必要)

別名:Flow


typeCastExpression

JavaScript
t.typeCastExpression(expression, typeAnnotation);

另請參閱 t.isTypeCastExpression(node, opts)t.assertTypeCastExpression(node, opts)

AST 節點 TypeCastExpression 形狀

  • expressionExpression(必要)
  • 類型註解類型註解(必要)

別名:FlowExpressionWrapperExpression


typeParameter

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

另請參閱 t.isTypeParameter(node, opts)t.assertTypeParameter(node, opts)

AST 節點 TypeParameter 形狀

  • boundTypeAnnotation(預設:null
  • defaultFlowType(預設:null
  • varianceVariance(預設:null
  • name: string(必要)

別名:Flow


typeParameterDeclaration

JavaScript
t.typeParameterDeclaration(params);

另請參閱 t.isTypeParameterDeclaration(node, opts)t.assertTypeParameterDeclaration(node, opts)

AST 節點 TypeParameterDeclaration 形狀

  • paramsArray<TypeParameter>(必要)

別名:Flow


typeParameterInstantiation

JavaScript
t.typeParameterInstantiation(params);

另請參閱 t.isTypeParameterInstantiation(node, opts)t.assertTypeParameterInstantiation(node, opts)

AST 節點 TypeParameterInstantiation 形狀

  • paramsArray<FlowType>(必要)

別名:Flow


typeofTypeAnnotation

JavaScript
t.typeofTypeAnnotation(argument);

另請參閱 t.isTypeofTypeAnnotation(node, opts)t.assertTypeofTypeAnnotation(node, opts)

AST 節點 TypeofTypeAnnotation 形狀

  • argumentFlowType(必要)

別名:FlowFlowType


unaryExpression

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

另請參閱 t.isUnaryExpression(node, opts)t.assertUnaryExpression(node, opts)

AST 節點 UnaryExpression 形狀

  • operator"void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof"(必要)
  • argument: Expression(必要)
  • prefixboolean(預設:true

別名:StandardizedUnaryLikeExpression


unionTypeAnnotation

JavaScript
t.unionTypeAnnotation(types);

另請參閱 t.isUnionTypeAnnotation(node, opts)t.assertUnionTypeAnnotation(node, opts)

AST 節點 UnionTypeAnnotation 形狀

  • types: Array<FlowType>(必要)

別名:FlowFlowType


updateExpression

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

另請參閱 t.isUpdateExpression(node, opts)t.assertUpdateExpression(node, opts)

AST 節點 UpdateExpression 形狀

  • operator: "++" | "--"(必填)
  • argument: Expression(必要)
  • prefix: boolean(預設值:false

別名:StandardizedExpression


v8IntrinsicIdentifier

JavaScript
t.v8IntrinsicIdentifier(name);

另請參閱 t.isV8IntrinsicIdentifier(node, opts)t.assertV8IntrinsicIdentifier(node, opts)

AST 節點 V8IntrinsicIdentifier 形狀

  • name: string(必要)

別名:Miscellaneous


variableDeclaration

JavaScript
t.variableDeclaration(kind, declarations);
歷史
版本變更
v7.20.0kind 可以是「using」。

另請參閱 t.isVariableDeclaration(node, opts)t.assertVariableDeclaration(node, opts)

AST 節點 VariableDeclaration 形狀

  • kind: "var" | "let" | "const" | "using" | "await using"(必填)
  • declarations: Array<VariableDeclarator>(必填)
  • declare: boolean(預設值:null,排除於建構函數之外)

別名:StandardizedStatementDeclaration


variableDeclarator

JavaScript
t.variableDeclarator(id, init);

另請參閱 t.isVariableDeclarator(node, opts)t.assertVariableDeclarator(node, opts)

AST 節點 VariableDeclarator 形狀

  • id: LVal(必填)
  • init: Expression(預設值:null
  • definite: boolean(預設值:null,排除於建構函數之外)

別名:Standardized


variance

JavaScript
t.variance(kind);

另請參閱 t.isVariance(node, opts)t.assertVariance(node, opts)

AST 節點 Variance 形狀

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

別名:Flow


voidTypeAnnotation

JavaScript
t.voidTypeAnnotation();

另請參閱 t.isVoidTypeAnnotation(node, opts)t.assertVoidTypeAnnotation(node, opts)

別名:FlowFlowTypeFlowBaseAnnotation


whileStatement

JavaScript
t.whileStatement(test, body);

另請參閱 t.isWhileStatement(node, opts)t.assertWhileStatement(node, opts)

AST 節點 WhileStatement 形狀

  • testExpression(必要)
  • body: 敘述 (必要)

別名:標準化敘述區塊父項迴圈While可設定範圍


withStatement

JavaScript
t.withStatement(object, body);

另請參閱 t.isWithStatement(node, opts)t.assertWithStatement(node, opts)

AST 節點 WithStatement 形狀

  • 物件表達式(必填)
  • body: 敘述 (必要)

別名:StandardizedStatement


yieldExpression

JavaScript
t.yieldExpression(argument, delegate);

另請參閱 t.isYieldExpression(node, opts)t.assertYieldExpression(node, opts)

AST 節點 YieldExpression 形狀

  • argument: Expression(預設值:null
  • delegateboolean(預設:false

別名:StandardizedExpressionTerminatorless


別名

存取器

已棄用。將在 Babel 8 中移除。

JavaScript
t.isAccessor(node);

涵蓋的節點

Binary

BinaryExpression 和 LogicalExpression 的涵蓋範圍,它們共用相同的 AST 形狀。

JavaScript
t.isBinary(node);

涵蓋的節點

Block

已棄用。將在 Babel 8 中移除。

JavaScript
t.isBlock(node);

涵蓋的節點

BlockParent

AST 節點的涵蓋範圍,它們以新的 LexicalEnvironment 開始執行環境。換句話說,它們定義了 letconst 宣告的範圍。

JavaScript
t.isBlockParent(node);

涵蓋的節點

類別

ClassExpression 和 ClassDeclaration 的封裝,它們共用相同的 AST 形狀。

JavaScript
t.isClass(node);

涵蓋的節點

完成陳述式

表示完成記錄的陳述式。換句話說,它們定義程式的控制流程,例如迴圈何時中斷或動作擲出重大錯誤。

JavaScript
t.isCompletionStatement(node);

涵蓋的節點

條件式

ConditionalExpression 和 IfStatement 的封裝,它們共用相同的 AST 形狀。

JavaScript
t.isConditional(node);

涵蓋的節點

宣告

任何宣告的封裝。

JavaScript
t.isDeclaration(node);

涵蓋的節點

列舉主體

Flow 列舉主體的涵蓋範圍。

JavaScript
t.isEnumBody(node);

涵蓋的節點

列舉成員

Flow 列舉成員的涵蓋範圍。

JavaScript
t.isEnumMember(node);

涵蓋的節點

匯出宣告

任何 ExportDeclaration 的涵蓋範圍。

JavaScript
t.isExportDeclaration(node);

涵蓋的節點

表達式

任何 Expression 的涵蓋範圍。

JavaScript
t.isExpression(node);

涵蓋的節點

ExpressionWrapper

不具備執行時期語意的表達式包裝器。

JavaScript
t.isExpressionWrapper(node);

涵蓋的節點

Flow

Flow 定義的 AST 節點涵蓋範圍。

JavaScript
t.isFlow(node);

涵蓋的節點

FlowBaseAnnotation

主要 Flow 型別註解的涵蓋範圍。

JavaScript
t.isFlowBaseAnnotation(node);

涵蓋的節點

FlowDeclaration

Flow 宣告的涵蓋範圍。

JavaScript
t.isFlowDeclaration(node);

涵蓋的節點

FlowPredicate

Flow 謂詞的涵蓋範圍。

JavaScript
t.isFlowPredicate(node);

涵蓋的節點

FlowType

Flow 型別註解的涵蓋範圍。

JavaScript
t.isFlowType(node);

涵蓋的節點

For

涵蓋 ForStatementForXStatement

JavaScript
t.isFor(node);

涵蓋的節點

ForXStatement

涵蓋 ForInStatements 和 ForOfStatements

JavaScript
t.isForXStatement(node);

涵蓋的節點

Function

函式和 方法 的涵蓋範圍,必須有 bodyparams。注意:FunctionFunctionParent 不同。例如,StaticBlockFunctionParent 但不是 Function

JavaScript
t.isFunction(node);

涵蓋的節點

FunctionParent

涵蓋使用新的 VariableEnvironment 開始執行內容的 AST 節點。換句話說,它們定義 var 宣告的範圍。從 Babel 7 開始,FunctionParent 不包含 Program

JavaScript
t.isFunctionParent(node);

涵蓋的節點

Immutable

不可變物件和 JSX 元素的涵蓋範圍。如果在建立後無法定義其他屬性,則物件為 不可變

JavaScript
t.isImmutable(node);

涵蓋的節點

ImportOrExportDeclaration

歷史
版本變更
v7.21.0已引入

ImportDeclaration 和 ExportDeclaration 的涵蓋範圍。

JavaScript
t.isImportOrExportDeclaration(node);

涵蓋的節點

JSX

JSX 定義的 AST 節點的涵蓋範圍。

JavaScript
t.isJSX(node);

涵蓋的節點

LVal

涵蓋用於賦值運算式的 leftForXStatement 的左手邊運算式。

JavaScript
t.isLVal(node);

涵蓋的節點

Literal

涵蓋 LiteralRegular Expression LiteralTemplate Literal

JavaScript
t.isLiteral(node);

涵蓋的節點

Loop

迴圈語法的涵蓋範圍。

JavaScript
t.isLoop(node);

涵蓋的節點

方法

物件方法和類別方法的涵蓋範圍。

JavaScript
t.isMethod(node);

涵蓋的節點

雜項

有時對開發有用的非標準 AST 類型涵蓋範圍。

JavaScript
t.isMiscellaneous(node);

涵蓋的節點

ModuleDeclaration

歷史
版本變更
v7.21.0已棄用
注意

已棄用,請改用 ImportOrExportDeclaration。查看 PR #15266 以取得遷移注意事項。

JavaScript
t.isModuleDeclaration(node);

涵蓋的節點

ModuleSpecifier

涵蓋匯入和匯出指定項。注意:它不是規範中定義的 ModuleSpecifier

JavaScript
t.isModuleSpecifier(node);

涵蓋的節點

ObjectMember

涵蓋物件文字中的 成員

JavaScript
t.isObjectMember(node);

涵蓋的節點

Pattern

涵蓋 BindingPattern,但排除識別項。

JavaScript
t.isPattern(node);

涵蓋的節點

PatternLike

一個 BindingPattern 的封面。

JavaScript
t.isPatternLike(node);

涵蓋的節點

私有

一個私有類別元素和私有識別碼的封面。

JavaScript
t.isPrivate(node);

涵蓋的節點

屬性

一個物件屬性和類別屬性的封面。

JavaScript
t.isProperty(node);

涵蓋的節點

Pureish

一個沒有副作用的 AST 節點的封面。換句話說,如果它們被評估超過一次,則沒有可觀察到的行為改變。

JavaScript
t.isPureish(node);

涵蓋的節點

Scopable

一個 FunctionParentBlockParent 的封面。

JavaScript
t.isScopable(node);

涵蓋的節點

標準化

一個屬於官方 ECMAScript 規範一部分的 AST 節點的封面。

JavaScript
t.isStandardized(node);

涵蓋的節點

陳述

任何 陳述 的封面。

JavaScript
t.isStatement(node);

涵蓋的節點

TSBaseType

一個主要的 TypeScript 型別註解的封面。

JavaScript
t.isTSBaseType(node);

涵蓋的節點

TSEntityName

ts 實體的涵蓋範圍。

JavaScript
t.isTSEntityName(node);

涵蓋的節點

TSType

TypeScript 型別註解的涵蓋範圍。

JavaScript
t.isTSType(node);

涵蓋的節點

TSTypeElement

TypeScript 型別宣告的涵蓋範圍。

JavaScript
t.isTSTypeElement(node);

涵蓋的節點

Terminatorless

運算子與運算元之間插入換行符號時,語意會變更的 AST 節點涵蓋範圍。

JavaScript
t.isTerminatorless(node);

涵蓋的節點

TypeScript

為 TypeScript 定義的 AST 節點涵蓋範圍。

JavaScript
t.isTypeScript(node);

涵蓋的節點

UnaryLike

UnaryExpression 和 SpreadElement 的涵蓋範圍。

JavaScript
t.isUnaryLike(node);

涵蓋的節點

UserWhitespacable

已棄用。將在 Babel 8 中移除。

JavaScript
t.isUserWhitespacable(node);

涵蓋的節點

While

DoWhileStatement 和 WhileStatement 的涵蓋範圍,它們共用相同的 AST 形狀。

JavaScript
t.isWhile(node);

涵蓋的節點