Vai al contenuto principale

@babel/types

Traduzione Beta Non Ufficiale

Questa pagina è stata tradotta da PageTurner AI (beta). Non ufficialmente approvata dal progetto. Hai trovato un errore? Segnala problema →

Questo modulo contiene metodi per costruire manualmente AST e per verificare i tipi dei nodi AST.

Installazione

npm install --save-dev @babel/types

API

Costruttori di nodi

anyTypeAnnotation

JavaScript
t.anyTypeAnnotation();

Vedi anche t.isAnyTypeAnnotation(node, opts) e t.assertAnyTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


argumentPlaceholder

JavaScript
t.argumentPlaceholder();

Vedi anche t.isArgumentPlaceholder(node, opts) e t.assertArgumentPlaceholder(node, opts).


arrayExpression

JavaScript
t.arrayExpression(elements);

Vedi anche t.isArrayExpression(node, opts) e t.assertArrayExpression(node, opts).

Struttura del nodo AST ArrayExpression:

  • elements: (null | Expression | SpreadElement)[] (predefinito: [])

Alias: Standardized, Expression


arrayPattern

JavaScript
t.arrayPattern(elements);

Vedi anche t.isArrayPattern(node, opts) e t.assertArrayPattern(node, opts).

Struttura del nodo AST ArrayPattern:

  • elements: (null | PatternLike)[] (obbligatorio)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, FunctionParameter, Pattern, PatternLike, LVal


arrayTypeAnnotation

JavaScript
t.arrayTypeAnnotation(elementType);

Vedi anche t.isArrayTypeAnnotation(node, opts) e t.assertArrayTypeAnnotation(node, opts).

Struttura del nodo AST ArrayTypeAnnotation:

  • elementType: FlowType (obbligatorio)

Alias: Flow, FlowType


arrowFunctionExpression

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

Vedi anche t.isArrowFunctionExpression(node, opts) e t.assertArrowFunctionExpression(node, opts).

Struttura del nodo AST ArrowFunctionExpression:

  • params: FunctionParameter[] (obbligatorio)

  • body: BlockStatement | Expression (obbligatorio)

  • async: boolean (predefinito: false)

  • expression: boolean (obbligatorio)

  • generator: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • predicate: DeclaredPredicate | InferredPredicate (predefinito: null, escluso dalla funzione di costruzione)

  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

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


assignmentExpression

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

Vedi anche t.isAssignmentExpression(node, opts) e t.assertAssignmentExpression(node, opts).

Struttura del nodo AST AssignmentExpression:

  • operator: string (obbligatorio)

  • left: LVal | OptionalMemberExpression (obbligatorio)

  • right: Expression (obbligatorio)

Alias: Standardized, Expression


assignmentPattern

JavaScript
t.assignmentPattern(left, right);

Vedi anche t.isAssignmentPattern(node, opts) e t.assertAssignmentPattern(node, opts).

Struttura del nodo AST AssignmentPattern:

  • left: Identifier | ObjectPattern | ArrayPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression (obbligatorio)

  • right: Expression (obbligatorio)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, FunctionParameter, Pattern, PatternLike, LVal


awaitExpression

JavaScript
t.awaitExpression(argument);

Vedi anche t.isAwaitExpression(node, opts) e t.assertAwaitExpression(node, opts).

Struttura del nodo AST AwaitExpression:

  • argument: Expression (obbligatorio)

Alias: Standardized, Expression, Terminatorless


bigIntLiteral

JavaScript
t.bigIntLiteral(value);

Vedi anche t.isBigIntLiteral(node, opts) e t.assertBigIntLiteral(node, opts).

Struttura del nodo AST BigIntLiteral:

  • value: string (obbligatorio)

Alias: Standardized, Expression, Pureish, Literal, Immutable


binaryExpression

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

Vedi anche t.isBinaryExpression(node, opts) e t.assertBinaryExpression(node, opts).

Struttura del nodo AST BinaryExpression:

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

  • left: Expression | PrivateName (obbligatorio)

  • right: Expression (obbligatorio)

Alias: Standardized, Binary, Expression


bindExpression

JavaScript
t.bindExpression(object, callee);

Vedi anche t.isBindExpression(node, opts) e t.assertBindExpression(node, opts).

Forma del nodo AST BindExpression:

  • object: Expression (obbligatorio)

  • callee: Expression (obbligatorio)

Alias: Expression


blockStatement

JavaScript
t.blockStatement(body, directives);

Vedi anche t.isBlockStatement(node, opts) e t.assertBlockStatement(node, opts).

Forma del nodo AST BlockStatement:

  • body: Statement[] (obbligatorio)

  • directives: Directive[] (predefinito: [])

Alias: Standardized, Scopable, BlockParent, Block, Statement


booleanLiteral

JavaScript
t.booleanLiteral(value);

Vedi anche t.isBooleanLiteral(node, opts) e t.assertBooleanLiteral(node, opts).

Forma del nodo AST BooleanLiteral:

  • value: boolean (obbligatorio)

Alias: Standardized, Expression, Pureish, Literal, Immutable


booleanLiteralTypeAnnotation

JavaScript
t.booleanLiteralTypeAnnotation(value);

Vedi anche t.isBooleanLiteralTypeAnnotation(node, opts) e t.assertBooleanLiteralTypeAnnotation(node, opts).

Forma del nodo AST BooleanLiteralTypeAnnotation:

  • value: boolean (obbligatorio)

Alias: Flow, FlowType


booleanTypeAnnotation

JavaScript
t.booleanTypeAnnotation();

Vedi anche t.isBooleanTypeAnnotation(node, opts) e t.assertBooleanTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


breakStatement

JavaScript
t.breakStatement(label);

Vedi anche t.isBreakStatement(node, opts) e t.assertBreakStatement(node, opts).

Forma del nodo AST BreakStatement:

  • label: Identifier (default: null)

Alias: Standardized, Statement, Terminatorless, CompletionStatement


callExpression

JavaScript
t.callExpression(callee, arguments);

Vedi anche t.isCallExpression(node, opts) e t.assertCallExpression(node, opts).

Forma del nodo AST CallExpression:

  • callee: Expression | Super | V8IntrinsicIdentifier (obbligatorio)

  • arguments: (Expression | SpreadElement | ArgumentPlaceholder)[] (obbligatorio)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeArguments: TypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

  • typeParameters: TSTypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

Alias: Standardized, Expression


catchClause

JavaScript
t.catchClause(param, body);

Vedi anche t.isCatchClause(node, opts) e t.assertCatchClause(node, opts).

Forma del nodo AST CatchClause:

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

  • body: BlockStatement (obbligatorio)

Alias: Standardized, Scopable, BlockParent


classAccessorProperty

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

Vedi anche t.isClassAccessorProperty(node, opts) e t.assertClassAccessorProperty(node, opts).

Forma del nodo AST ClassAccessorProperty:

  • key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName (obbligatorio)

  • value: Expression (default: null)

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

  • decorators: Decorator[] (predefinito: null)

  • computed: boolean (predefinito: false)

  • static: boolean (default: false)

  • abstract: boolean (valore predefinito: null, escluso dalla funzione di costruzione)

  • accessibility: "public" | "private" | "protected" (predefinito: null, escluso dalla funzione builder)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

  • definite: boolean (default: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • override: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • readonly: boolean (predefinito: null, escluso dalla funzione builder)

  • variance: Variance (default: null, esclusa dalla funzione builder)

Alias: Standardized, Property, Accessor


classBody

JavaScript
t.classBody(body);

Vedi anche t.isClassBody(node, opts) e t.assertClassBody(node, opts).

Forma del nodo AST ClassBody:

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

Alias: Standardized


classDeclaration

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

Vedi anche t.isClassDeclaration(node, opts) e t.assertClassDeclaration(node, opts).

Forma del nodo AST ClassDeclaration:

  • id: Identifier (default: null)

  • superClass: Expression (predefinito: null)

  • body: ClassBody (obbligatorio)

  • decorators: Decorator[] (predefinito: null)

  • abstract: boolean (valore predefinito: null, escluso dalla funzione di costruzione)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

  • implements: (TSExpressionWithTypeArguments | ClassImplements)[] (predefinito: null, escluso dalla funzione builder)

  • mixins: InterfaceExtends (predefinito: null, escluso dalla funzione builder)

  • superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Scopable, Class, Statement, Declaration


classExpression

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

Vedi anche t.isClassExpression(node, opts) e t.assertClassExpression(node, opts).

Struttura del nodo AST ClassExpression:

  • id: Identifier (default: null)

  • superClass: Expression (predefinito: null)

  • body: ClassBody (obbligatorio)

  • decorators: Decorator[] (predefinito: null)

  • implements: (TSExpressionWithTypeArguments | ClassImplements)[] (predefinito: null, escluso dalla funzione builder)

  • mixins: InterfaceExtends (predefinito: null, escluso dalla funzione builder)

  • superTypeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Scopable, Class, Expression


classImplements

JavaScript
t.classImplements(id, typeParameters);

Vedi anche t.isClassImplements(node, opts) e t.assertClassImplements(node, opts).

Struttura del nodo AST ClassImplements:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterInstantiation (default: null)

Alias: Flow


classMethod

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

Vedi anche t.isClassMethod(node, opts) e t.assertClassMethod(node, opts).

Struttura del nodo AST ClassMethod:

  • kind: "get" | "set" | "method" | "constructor" (predefinito: 'method')

  • key: se computed allora Expression altrimenti Identifier | Literal (obbligatorio)

  • params: (FunctionParameter | TSParameterProperty)[] (obbligatorio)

  • body: BlockStatement (obbligatorio)

  • computed: boolean (predefinito: false)

  • static: boolean (default: false)

  • generator: boolean (predefinito: false)

  • async: boolean (predefinito: false)

  • abstract: boolean (valore predefinito: null, escluso dalla funzione di costruzione)

  • access: "public" | "private" | "protected" (valore predefinito: null, escluso dalla funzione di costruzione)

  • accessibility: "public" | "private" | "protected" (predefinito: null, escluso dalla funzione builder)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • override: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

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


classPrivateMethod

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

Vedi anche t.isClassPrivateMethod(node, opts) e t.assertClassPrivateMethod(node, opts).

Struttura del nodo AST ClassPrivateMethod:

  • kind: "get" | "set" | "method" (valore predefinito: 'method')

  • key: PrivateName (obbligatorio)

  • params: (FunctionParameter | TSParameterProperty)[] (obbligatorio)

  • body: BlockStatement (obbligatorio)

  • static: boolean (default: false)

  • abstract: boolean (valore predefinito: null, escluso dalla funzione di costruzione)

  • access: "public" | "private" | "protected" (valore predefinito: null, escluso dalla funzione di costruzione)

  • accessibility: "public" | "private" | "protected" (predefinito: null, escluso dalla funzione builder)

  • async: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • computed: 'false' (valore predefinito: false, escluso dalla funzione builder)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • generator: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • override: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

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


classPrivateProperty

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

Vedi anche t.isClassPrivateProperty(node, opts) e t.assertClassPrivateProperty(node, opts).

Struttura del nodo AST ClassPrivateProperty:

  • key: PrivateName (obbligatorio)

  • value: Expression (default: null)

  • decorators: Decorator[] (predefinito: null)

  • static: boolean (default: false)

  • definite: boolean (default: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • readonly: boolean (predefinito: null, escluso dalla funzione builder)

  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

  • variance: Variance (default: null, esclusa dalla funzione builder)

Alias: Standardized, Property, Private


classProperty

JavaScript
t.classProperty(key, value, typeAnnotation, decorators, computed, static);
History
VersionChanges
v7.6.0Supports static

Vedi anche t.isClassProperty(node, opts) e t.assertClassProperty(node, opts).

Forma del nodo AST ClassProperty:

  • key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression (obbligatorio)

  • value: Expression (default: null)

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

  • decorators: Decorator[] (predefinito: null)

  • computed: boolean (predefinito: false)

  • static: boolean (default: false)

  • abstract: boolean (valore predefinito: null, escluso dalla funzione di costruzione)

  • accessibility: "public" | "private" | "protected" (predefinito: null, escluso dalla funzione builder)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

  • definite: boolean (default: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • override: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • readonly: boolean (predefinito: null, escluso dalla funzione builder)

  • variance: Variance (default: null, esclusa dalla funzione builder)

Alias: Standardized, Property


conditionalExpression

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

Vedi anche t.isConditionalExpression(node, opts) e t.assertConditionalExpression(node, opts).

Forma del nodo AST ConditionalExpression:

  • test: Expression (obbligatorio)

  • consequent: Expression (obbligatorio)

  • alternate: Expression (obbligatorio)

Alias: Standardized, Expression, Conditional


continueStatement

JavaScript
t.continueStatement(label);

Vedi anche t.isContinueStatement(node, opts) e t.assertContinueStatement(node, opts).

Forma del nodo AST ContinueStatement:

  • label: Identifier (default: null)

Alias: Standardized, Statement, Terminatorless, CompletionStatement


debuggerStatement

JavaScript
t.debuggerStatement();

Vedi anche t.isDebuggerStatement(node, opts) e t.assertDebuggerStatement(node, opts).

Alias: Standardized, Statement


decimalLiteral

JavaScript
t.decimalLiteral(value);

Vedi anche t.isDecimalLiteral(node, opts) e t.assertDecimalLiteral(node, opts).

Forma del nodo AST DecimalLiteral:

  • value: string (obbligatorio)

Alias: Expression, Pureish, Literal, Immutable


declareClass

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

Vedi anche t.isDeclareClass(node, opts) e t.assertDeclareClass(node, opts).

Forma del nodo AST DeclareClass:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • extends: InterfaceExtends[] (predefinito: null)

  • body: ObjectTypeAnnotation (obbligatorio)

  • implements: ClassImplements[] (predefinito: null, escluso dalla funzione builder)

  • mixins: InterfaceExtends[] (predefinito: null, escluso dalla funzione builder)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareExportAllDeclaration

JavaScript
t.declareExportAllDeclaration(source, attributes);

Vedi anche t.isDeclareExportAllDeclaration(node, opts) e t.assertDeclareExportAllDeclaration(node, opts).

Forma del nodo AST DeclareExportAllDeclaration:

  • source: StringLiteral (obbligatorio)

  • attributes: ImportAttribute[] (predefinito: null)

  • assertions: ImportAttribute[] (predefinito: null, escluso dalla funzione builder)

  • exportKind: "type" | "value" (predefinito: null, escluso dalla funzione builder)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareExportDeclaration

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

Vedi anche t.isDeclareExportDeclaration(node, opts) e t.assertDeclareExportDeclaration(node, opts).

Forma del nodo AST DeclareExportDeclaration:

  • declaration: Flow (default: null)

  • specifiers: (ExportSpecifier | ExportNamespaceSpecifier)[] (predefinito: null)

  • source: StringLiteral (predefinito: null)

  • attributes: ImportAttribute[] (predefinito: null)

  • assertions: ImportAttribute[] (predefinito: null, escluso dalla funzione builder)

  • default: boolean (default: null, escluso dalla funzione builder)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareFunction

JavaScript
t.declareFunction(id);

Vedi anche t.isDeclareFunction(node, opts) e t.assertDeclareFunction(node, opts).

Forma del nodo AST DeclareFunction:

  • id: Identifier (obbligatorio)

  • predicate: DeclaredPredicate (default: null, escluso dalla funzione builder)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareInterface

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

Vedi anche t.isDeclareInterface(node, opts) e t.assertDeclareInterface(node, opts).

Forma del nodo AST DeclareInterface:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • extends: InterfaceExtends[] (predefinito: null)

  • body: ObjectTypeAnnotation (obbligatorio)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareModule

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

Vedi anche t.isDeclareModule(node, opts) e t.assertDeclareModule(node, opts).

Forma del nodo AST DeclareModule:

  • id: Identifier | StringLiteral (obbligatorio)

  • body: BlockStatement (obbligatorio)

  • kind: "CommonJS" | "ES" (predefinito: null)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareModuleExports

JavaScript
t.declareModuleExports(typeAnnotation);

Vedi anche t.isDeclareModuleExports(node, opts) e t.assertDeclareModuleExports(node, opts).

Forma del nodo AST DeclareModuleExports:

  • typeAnnotation: TypeAnnotation (obbligatorio)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareOpaqueType

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

Vedi anche t.isDeclareOpaqueType(node, opts) e t.assertDeclareOpaqueType(node, opts).

Forma del nodo AST DeclareOpaqueType:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • supertype: FlowType (predefinito: null)

  • impltype: FlowType (predefinito: null, escluso dalla funzione builder)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareTypeAlias

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

Vedi anche t.isDeclareTypeAlias(node, opts) e t.assertDeclareTypeAlias(node, opts).

Forma del nodo AST DeclareTypeAlias:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • right: FlowType (obbligatorio)

Alias: Flow, FlowDeclaration, Statement, Declaration


declareVariable

JavaScript
t.declareVariable(id);

Vedi anche t.isDeclareVariable(node, opts) e t.assertDeclareVariable(node, opts).

Forma del nodo AST DeclareVariable:

  • id: Identifier (obbligatorio)

Alias: Flow, FlowDeclaration, Statement, Declaration


declaredPredicate

JavaScript
t.declaredPredicate(value);

Vedi anche t.isDeclaredPredicate(node, opts) e t.assertDeclaredPredicate(node, opts).

Forma del nodo AST DeclaredPredicate:

  • value: Flow (obbligatorio)

Alias: Flow, FlowPredicate


decorator

JavaScript
t.decorator(expression);

Vedi anche t.isDecorator(node, opts) e t.assertDecorator(node, opts).

Forma del nodo AST Decorator:

  • expression: Expression (obbligatorio)

directive

JavaScript
t.directive(value);

Vedi anche t.isDirective(node, opts) e t.assertDirective(node, opts).

Forma del nodo AST Directive:

  • value: DirectiveLiteral (obbligatorio)

Alias: Standardized


directiveLiteral

JavaScript
t.directiveLiteral(value);

Vedi anche t.isDirectiveLiteral(node, opts) e t.assertDirectiveLiteral(node, opts).

Forma del nodo AST DirectiveLiteral:

  • value: string (obbligatorio)

Alias: Standardized


doExpression

JavaScript
t.doExpression(body, async);

Vedi anche t.isDoExpression(node, opts) e t.assertDoExpression(node, opts).

Forma del nodo AST DoExpression:

  • body: BlockStatement (obbligatorio)

  • async: boolean (predefinito: false)

Alias: Expression


doWhileStatement

JavaScript
t.doWhileStatement(test, body);

Vedi anche t.isDoWhileStatement(node, opts) e t.assertDoWhileStatement(node, opts).

Forma del nodo AST DoWhileStatement:

  • test: Expression (obbligatorio)

  • body: Statement (obbligatorio)

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


emptyStatement

JavaScript
t.emptyStatement();

Vedi anche t.isEmptyStatement(node, opts) e t.assertEmptyStatement(node, opts).

Alias: Standardized, Statement


emptyTypeAnnotation

JavaScript
t.emptyTypeAnnotation();

Vedi anche t.isEmptyTypeAnnotation(node, opts) e t.assertEmptyTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


enumBooleanBody

JavaScript
t.enumBooleanBody(members);

Vedi anche t.isEnumBooleanBody(node, opts) e t.assertEnumBooleanBody(node, opts).

Forma del nodo AST EnumBooleanBody:

  • members: EnumBooleanMember[] (obbligatorio)

  • explicitType: boolean (obbligatorio)

  • hasUnknownMembers: boolean (obbligatorio)

Alias: Flow, EnumBody


enumBooleanMember

JavaScript
t.enumBooleanMember(id);

Vedi anche t.isEnumBooleanMember(node, opts) e t.assertEnumBooleanMember(node, opts).

Struttura del nodo AST EnumBooleanMember:

  • id: Identifier (obbligatorio)

  • init: BooleanLiteral (obbligatorio)

Alias: Flow, EnumMember


enumDeclaration

JavaScript
t.enumDeclaration(id, body);

Vedi anche t.isEnumDeclaration(node, opts) e t.assertEnumDeclaration(node, opts).

Struttura del nodo AST EnumDeclaration:

  • id: Identifier (obbligatorio)

  • body: EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody (obbligatorio)

Alias: Flow, Statement, Declaration


enumDefaultedMember

JavaScript
t.enumDefaultedMember(id);

Vedi anche t.isEnumDefaultedMember(node, opts) e t.assertEnumDefaultedMember(node, opts).

Struttura del nodo AST EnumDefaultedMember:

  • id: Identifier (obbligatorio)

Alias: Flow, EnumMember


enumNumberBody

JavaScript
t.enumNumberBody(members);

Vedi anche t.isEnumNumberBody(node, opts) e t.assertEnumNumberBody(node, opts).

Struttura del nodo AST EnumNumberBody:

  • members: EnumNumberMember[] (obbligatorio)

  • explicitType: boolean (obbligatorio)

  • hasUnknownMembers: boolean (obbligatorio)

Alias: Flow, EnumBody


enumNumberMember

JavaScript
t.enumNumberMember(id, init);

Vedi anche t.isEnumNumberMember(node, opts) e t.assertEnumNumberMember(node, opts).

Struttura del nodo AST EnumNumberMember:

  • id: Identifier (obbligatorio)

  • init: NumericLiteral (obbligatorio)

Alias: Flow, EnumMember


enumStringBody

JavaScript
t.enumStringBody(members);

Vedi anche t.isEnumStringBody(node, opts) e t.assertEnumStringBody(node, opts).

Struttura del nodo AST EnumStringBody:

  • members: (EnumStringMember | EnumDefaultedMember)[] (obbligatorio)

  • explicitType: boolean (obbligatorio)

  • hasUnknownMembers: boolean (obbligatorio)

Alias: Flow, EnumBody


enumStringMember

JavaScript
t.enumStringMember(id, init);

Vedi anche t.isEnumStringMember(node, opts) e t.assertEnumStringMember(node, opts).

Struttura del nodo AST EnumStringMember:

  • id: Identifier (obbligatorio)

  • init: StringLiteral (obbligatorio)

Alias: Flow, EnumMember


enumSymbolBody

JavaScript
t.enumSymbolBody(members);

Vedi anche t.isEnumSymbolBody(node, opts) e t.assertEnumSymbolBody(node, opts).

Forma del nodo AST EnumSymbolBody:

  • members: EnumDefaultedMember[] (obbligatorio)

  • hasUnknownMembers: boolean (obbligatorio)

Alias: Flow, EnumBody


existsTypeAnnotation

JavaScript
t.existsTypeAnnotation();

Vedi anche t.isExistsTypeAnnotation(node, opts) e t.assertExistsTypeAnnotation(node, opts).

Alias: Flow, FlowType


exportAllDeclaration

JavaScript
t.exportAllDeclaration(source, attributes);
History
VersionChanges
v7.29.0Supports attributes

Vedi anche t.isExportAllDeclaration(node, opts) e t.assertExportAllDeclaration(node, opts).

Forma del nodo AST ExportAllDeclaration:

  • source: StringLiteral (obbligatorio)

  • attributes: ImportAttribute[] (predefinito: null)

  • assertions: ImportAttribute[] (predefinito: null, escluso dalla funzione builder)

  • exportKind: "type" | "value" (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportDefaultDeclaration

JavaScript
t.exportDefaultDeclaration(declaration);

Vedi anche t.isExportDefaultDeclaration(node, opts) e t.assertExportDefaultDeclaration(node, opts).

Forma del nodo AST ExportDefaultDeclaration:

  • declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression (obbligatorio)

  • exportKind: "value" (predefinito: null, escluso dalla funzione di costruzione)

Alias: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportDefaultSpecifier

JavaScript
t.exportDefaultSpecifier(exported);

Vedi anche t.isExportDefaultSpecifier(node, opts) e t.assertExportDefaultSpecifier(node, opts).

Forma del nodo AST ExportDefaultSpecifier:

  • exported: Identifier (obbligatorio)

Alias: ModuleSpecifier


exportNamedDeclaration

JavaScript
t.exportNamedDeclaration(declaration, specifiers, source, attributes);
History
VersionChanges
v7.29.0Supports attributes

Vedi anche t.isExportNamedDeclaration(node, opts) e t.assertExportNamedDeclaration(node, opts).

Forma del nodo AST ExportNamedDeclaration:

  • declaration: Declaration (predefinito: null)

  • specifiers: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[] (predefinito: [])

  • source: StringLiteral (predefinito: null)

  • attributes: ImportAttribute[] (predefinito: null)

  • assertions: ImportAttribute[] (predefinito: null, escluso dalla funzione builder)

  • exportKind: "type" | "value" (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Statement, Declaration, ImportOrExportDeclaration, ExportDeclaration


exportNamespaceSpecifier

JavaScript
t.exportNamespaceSpecifier(exported);

Vedi anche t.isExportNamespaceSpecifier(node, opts) e t.assertExportNamespaceSpecifier(node, opts).

Forma del nodo AST ExportNamespaceSpecifier:

  • exported: Identifier (obbligatorio)

Alias: Standardized, ModuleSpecifier


exportSpecifier

JavaScript
t.exportSpecifier(local, exported);

Vedi anche t.isExportSpecifier(node, opts) e t.assertExportSpecifier(node, opts).

Forma del nodo AST ExportSpecifier:

  • local: Identifier (obbligatorio)

  • exported: Identifier | StringLiteral (obbligatorio)

  • exportKind: "type" | "value" (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, ModuleSpecifier


expressionStatement

JavaScript
t.expressionStatement(expression);

Vedi anche t.isExpressionStatement(node, opts) e t.assertExpressionStatement(node, opts).

Forma del nodo AST ExpressionStatement:

  • expression: Expression (obbligatorio)

Alias: Standardized, Statement, ExpressionWrapper


file

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

Vedi anche t.isFile(node, opts) e t.assertFile(node, opts).

Forma del nodo AST File:

  • program: Program (obbligatorio)

  • comments: (CommentBlock | CommentLine)[] (predefinito: null)

  • tokens: any[] (predefinito: null)

Alias: Standardized


forInStatement

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

Vedi anche t.isForInStatement(node, opts) e t.assertForInStatement(node, opts).

Forma del nodo AST ForInStatement:

  • left: VariableDeclaration | LVal (obbligatorio)

  • right: Expression (obbligatorio)

  • body: Statement (obbligatorio)

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


forOfStatement

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

Vedi anche t.isForOfStatement(node, opts) e t.assertForOfStatement(node, opts).

Forma del nodo AST ForOfStatement:

  • left: VariableDeclaration | LVal (obbligatorio)

  • right: Expression (obbligatorio)

  • body: Statement (obbligatorio)

  • await: boolean (predefinito: false)

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


forStatement

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

Vedi anche t.isForStatement(node, opts) e t.assertForStatement(node, opts).

Struttura del nodo AST ForStatement:

  • init: VariableDeclaration | Expression (predefinito: null)

  • test: Expression (predefinito: null)

  • update: Expression (predefinito: null)

  • body: Statement (obbligatorio)

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


functionDeclaration

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

Vedi anche t.isFunctionDeclaration(node, opts) e t.assertFunctionDeclaration(node, opts).

Struttura del nodo AST FunctionDeclaration:

  • id: Identifier (default: null)

  • params: FunctionParameter[] (obbligatorio)

  • body: BlockStatement (obbligatorio)

  • generator: boolean (predefinito: false)

  • async: boolean (predefinito: false)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

  • predicate: DeclaredPredicate | InferredPredicate (predefinito: null, escluso dalla funzione di costruzione)

  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

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


functionExpression

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

Vedi anche t.isFunctionExpression(node, opts) e t.assertFunctionExpression(node, opts).

Struttura del nodo AST FunctionExpression:

  • id: Identifier (default: null)

  • params: FunctionParameter[] (obbligatorio)

  • body: BlockStatement (obbligatorio)

  • generator: boolean (predefinito: false)

  • async: boolean (predefinito: false)

  • predicate: DeclaredPredicate | InferredPredicate (predefinito: null, escluso dalla funzione di costruzione)

  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

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


functionTypeAnnotation

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

Vedi anche t.isFunctionTypeAnnotation(node, opts) e t.assertFunctionTypeAnnotation(node, opts).

Forma del nodo AST FunctionTypeAnnotation:

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • params: FunctionTypeParam[] (obbligatorio)

  • rest: FunctionTypeParam (predefinito: null)

  • returnType: FlowType (obbligatorio)

  • this: FunctionTypeParam (predefinito: null, escluso dalla funzione builder)

Alias: Flow, FlowType


functionTypeParam

JavaScript
t.functionTypeParam(name, typeAnnotation);

Vedi anche t.isFunctionTypeParam(node, opts) e t.assertFunctionTypeParam(node, opts).

Forma del nodo AST FunctionTypeParam:

  • name: Identifier (predefinito: null)

  • typeAnnotation: FlowType (obbligatorio)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

Alias: Flow


genericTypeAnnotation

JavaScript
t.genericTypeAnnotation(id, typeParameters);

Vedi anche t.isGenericTypeAnnotation(node, opts) e t.assertGenericTypeAnnotation(node, opts).

Forma del nodo AST GenericTypeAnnotation:

  • id: Identifier | QualifiedTypeIdentifier (obbligatorio)

  • typeParameters: TypeParameterInstantiation (default: null)

Alias: Flow, FlowType


identifier

JavaScript
t.identifier(name);

Vedi anche t.isIdentifier(node, opts) e t.assertIdentifier(node, opts).

Forma del nodo AST Identifier:

  • name: string (obbligatorio)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Expression, FunctionParameter, PatternLike, LVal, TSEntityName


ifStatement

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

Vedi anche t.isIfStatement(node, opts) e t.assertIfStatement(node, opts).

Forma del nodo AST IfStatement:

  • test: Expression (obbligatorio)

  • consequent: Statement (obbligatorio)

  • alternate: Statement (predefinito: null)

Alias: Standardized, Statement, Conditional


import

JavaScript
t.import();

Vedi anche t.isImport(node, opts) e t.assertImport(node, opts).

Alias: Standardized, Expression


importAttribute

JavaScript
t.importAttribute(key, value);

Vedi anche t.isImportAttribute(node, opts) e t.assertImportAttribute(node, opts).

Forma del nodo AST ImportAttribute:

  • key: Identifier | StringLiteral (obbligatorio)

  • value: StringLiteral (obbligatorio)

Alias: Standardized


importDeclaration

JavaScript
t.importDeclaration(specifiers, source, attributes);
History
VersionChanges
v7.20.0Supports module
v7.29.0Supports attributes

Vedi anche t.isImportDeclaration(node, opts) e t.assertImportDeclaration(node, opts).

Forma del nodo AST ImportDeclaration:

  • specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[] (obbligatorio)

  • source: StringLiteral (obbligatorio)

  • attributes: ImportAttribute[] (predefinito: null)

  • assertions: ImportAttribute[] (predefinito: null, escluso dalla funzione builder)

  • importKind: "type" | "typeof" | "value" (predefinito: null, escluso dalla funzione builder)

  • module: boolean (predefinito: null, escluso dalla funzione builder)

  • phase: "source" | "defer" (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Statement, Declaration, ImportOrExportDeclaration


importDefaultSpecifier

JavaScript
t.importDefaultSpecifier(local);

Vedi anche t.isImportDefaultSpecifier(node, opts) e t.assertImportDefaultSpecifier(node, opts).

Forma del nodo AST ImportDefaultSpecifier:

  • local: Identifier (obbligatorio)

Alias: Standardized, ModuleSpecifier


importExpression

JavaScript
t.importExpression(source, options);

Vedi anche t.isImportExpression(node, opts) e t.assertImportExpression(node, opts).

Forma del nodo AST ImportExpression:

  • source: Expression (obbligatorio)

  • options: Expression (predefinito: null)

  • phase: "source" | "defer" (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Expression


importNamespaceSpecifier

JavaScript
t.importNamespaceSpecifier(local);

Vedi anche t.isImportNamespaceSpecifier(node, opts) e t.assertImportNamespaceSpecifier(node, opts).

Forma del nodo AST ImportNamespaceSpecifier:

  • local: Identifier (obbligatorio)

Alias: Standardized, ModuleSpecifier


importSpecifier

JavaScript
t.importSpecifier(local, imported);

Vedi anche t.isImportSpecifier(node, opts) e t.assertImportSpecifier(node, opts).

Forma del nodo AST ImportSpecifier:

  • local: Identifier (obbligatorio)

  • imported: Identifier | StringLiteral (obbligatorio)

  • importKind: "type" | "typeof" | "value" (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, ModuleSpecifier


indexedAccessType

JavaScript
t.indexedAccessType(objectType, indexType);

Vedi anche t.isIndexedAccessType(node, opts) e t.assertIndexedAccessType(node, opts).

Struttura del nodo AST IndexedAccessType:

  • objectType: FlowType (obbligatorio)

  • indexType: FlowType (obbligatorio)

Alias: Flow, FlowType


inferredPredicate

JavaScript
t.inferredPredicate();

Vedi anche t.isInferredPredicate(node, opts) e t.assertInferredPredicate(node, opts).

Alias: Flow, FlowPredicate


interfaceDeclaration

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

Vedi anche t.isInterfaceDeclaration(node, opts) e t.assertInterfaceDeclaration(node, opts).

Struttura del nodo AST InterfaceDeclaration:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • extends: InterfaceExtends[] (predefinito: null)

  • body: ObjectTypeAnnotation (obbligatorio)

Alias: Flow, FlowDeclaration, Statement, Declaration


interfaceExtends

JavaScript
t.interfaceExtends(id, typeParameters);

Vedi anche t.isInterfaceExtends(node, opts) e t.assertInterfaceExtends(node, opts).

Struttura del nodo AST InterfaceExtends:

  • id: Identifier | QualifiedTypeIdentifier (obbligatorio)

  • typeParameters: TypeParameterInstantiation (default: null)

Alias: Flow


interfaceTypeAnnotation

JavaScript
t.interfaceTypeAnnotation(extends, body);

Vedi anche t.isInterfaceTypeAnnotation(node, opts) e t.assertInterfaceTypeAnnotation(node, opts).

Struttura del nodo AST InterfaceTypeAnnotation:

  • extends: InterfaceExtends[] (predefinito: null)

  • body: ObjectTypeAnnotation (obbligatorio)

Alias: Flow, FlowType


interpreterDirective

JavaScript
t.interpreterDirective(value);

Vedi anche t.isInterpreterDirective(node, opts) e t.assertInterpreterDirective(node, opts).

Struttura del nodo AST InterpreterDirective:

  • value: string (obbligatorio)

Alias: Standardized


intersectionTypeAnnotation

JavaScript
t.intersectionTypeAnnotation(types);

Vedi anche t.isIntersectionTypeAnnotation(node, opts) e t.assertIntersectionTypeAnnotation(node, opts).

Struttura del nodo AST IntersectionTypeAnnotation:

  • types: FlowType[] (obbligatorio)

Alias: Flow, FlowType


jsxAttribute

JavaScript
t.jsxAttribute(name, value);

Vedi anche t.isJSXAttribute(node, opts) e t.assertJSXAttribute(node, opts).

Struttura del nodo AST JSXAttribute:

  • name: JSXIdentifier | JSXNamespacedName (obbligatorio)

  • value: JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer (default: null)

Aliases: JSX, Immutable


jsxClosingElement

JavaScript
t.jsxClosingElement(name);

Vedi anche t.isJSXClosingElement(node, opts) e t.assertJSXClosingElement(node, opts).

Struttura nodo AST JSXClosingElement:

  • name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName (obbligatorio)

Aliases: JSX, Immutable


jsxClosingFragment

JavaScript
t.jsxClosingFragment();

Vedi anche t.isJSXClosingFragment(node, opts) e t.assertJSXClosingFragment(node, opts).

Aliases: JSX, Immutable


jsxElement

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

Vedi anche t.isJSXElement(node, opts) e t.assertJSXElement(node, opts).

Struttura nodo AST JSXElement:

  • openingElement: JSXOpeningElement (obbligatorio)

  • closingElement: JSXClosingElement (default: null)

  • children: (JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment)[] (obbligatorio)

  • selfClosing: boolean (default: null)

Alias: JSX, Immutable, Expression


jsxEmptyExpression

JavaScript
t.jsxEmptyExpression();

Vedi anche t.isJSXEmptyExpression(node, opts) e t.assertJSXEmptyExpression(node, opts).

Aliases: JSX


jsxExpressionContainer

JavaScript
t.jsxExpressionContainer(expression);

Vedi anche t.isJSXExpressionContainer(node, opts) e t.assertJSXExpressionContainer(node, opts).

Struttura nodo AST JSXExpressionContainer:

  • expression: Expression | JSXEmptyExpression (obbligatorio)

Aliases: JSX, Immutable


jsxFragment

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

Vedi anche t.isJSXFragment(node, opts) e t.assertJSXFragment(node, opts).

Struttura nodo AST JSXFragment:

  • openingFragment: JSXOpeningFragment (obbligatorio)

  • closingFragment: JSXClosingFragment (obbligatorio)

  • children: (JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment)[] (obbligatorio)

Alias: JSX, Immutable, Expression


jsxIdentifier

JavaScript
t.jsxIdentifier(name);

Vedi anche t.isJSXIdentifier(node, opts) e t.assertJSXIdentifier(node, opts).

Struttura nodo AST JSXIdentifier:

  • name: string (obbligatorio)

Aliases: JSX


jsxMemberExpression

JavaScript
t.jsxMemberExpression(object, property);

Vedi anche t.isJSXMemberExpression(node, opts) e t.assertJSXMemberExpression(node, opts).

Forma del nodo AST JSXMemberExpression:

  • object: JSXMemberExpression | JSXIdentifier (obbligatorio)

  • property: JSXIdentifier (obbligatorio)

Aliases: JSX


jsxNamespacedName

JavaScript
t.jsxNamespacedName(namespace, name);

Vedi anche t.isJSXNamespacedName(node, opts) e t.assertJSXNamespacedName(node, opts).

Forma del nodo AST JSXNamespacedName:

  • namespace: JSXIdentifier (obbligatorio)

  • name: JSXIdentifier (obbligatorio)

Aliases: JSX


jsxOpeningElement

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

Vedi anche t.isJSXOpeningElement(node, opts) e t.assertJSXOpeningElement(node, opts).

Forma del nodo AST JSXOpeningElement:

  • name: JSXIdentifier | JSXMemberExpression | JSXNamespacedName (obbligatorio)

  • attributes: (JSXAttribute | JSXSpreadAttribute)[] (obbligatorio)

  • selfClosing: boolean (predefinito: false)

  • typeArguments: TypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

  • typeParameters: TSTypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

Aliases: JSX, Immutable


jsxOpeningFragment

JavaScript
t.jsxOpeningFragment();

Vedi anche t.isJSXOpeningFragment(node, opts) e t.assertJSXOpeningFragment(node, opts).

Aliases: JSX, Immutable


jsxSpreadAttribute

JavaScript
t.jsxSpreadAttribute(argument);

Vedi anche t.isJSXSpreadAttribute(node, opts) e t.assertJSXSpreadAttribute(node, opts).

Forma del nodo AST JSXSpreadAttribute:

  • argument: Expression (obbligatorio)

Aliases: JSX


jsxSpreadChild

JavaScript
t.jsxSpreadChild(expression);

Vedi anche t.isJSXSpreadChild(node, opts) e t.assertJSXSpreadChild(node, opts).

Forma del nodo AST JSXSpreadChild:

  • expression: Expression (obbligatorio)

Aliases: JSX, Immutable


jsxText

JavaScript
t.jsxText(value);

Vedi anche t.isJSXText(node, opts) e t.assertJSXText(node, opts).

Forma del nodo AST JSXText:

  • value: string (obbligatorio)

Aliases: JSX, Immutable


labeledStatement

JavaScript
t.labeledStatement(label, body);

Vedi anche t.isLabeledStatement(node, opts) e t.assertLabeledStatement(node, opts).

Forma del nodo AST LabeledStatement:

  • label: Identifier (obbligatorio)

  • body: Statement (obbligatorio)

Alias: Standardized, Statement


logicalExpression

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

Vedi anche t.isLogicalExpression(node, opts) e t.assertLogicalExpression(node, opts).

Forma del nodo AST LogicalExpression:

  • operator: "||" | "&&" | "??" (obbligatorio)

  • left: Expression (obbligatorio)

  • right: Expression (obbligatorio)

Alias: Standardized, Binary, Expression


memberExpression

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

Vedi anche t.isMemberExpression(node, opts) e t.assertMemberExpression(node, opts).

Forma del nodo AST MemberExpression:

  • object: Expression | Super (obbligatorio)

  • property: se computato Expression altrimenti Identifier (obbligatorio)

  • computed: boolean (predefinito: false)

  • optional: boolean (default: null)

Alias: Standardized, Expression, LVal, PatternLike


metaProperty

JavaScript
t.metaProperty(meta, property);

Vedi anche t.isMetaProperty(node, opts) e t.assertMetaProperty(node, opts).

Forma del nodo AST MetaProperty:

  • meta: Identifier (obbligatorio)

  • property: Identifier (obbligatorio)

Alias: Standardized, Expression


mixedTypeAnnotation

JavaScript
t.mixedTypeAnnotation();

Vedi anche t.isMixedTypeAnnotation(node, opts) e t.assertMixedTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


moduleExpression

JavaScript
t.moduleExpression(body);

Vedi anche t.isModuleExpression(node, opts) e t.assertModuleExpression(node, opts).

Forma del nodo AST ModuleExpression:

  • body: Program (obbligatorio)

Alias: Expression


newExpression

JavaScript
t.newExpression(callee, arguments);

Vedi anche t.isNewExpression(node, opts) e t.assertNewExpression(node, opts).

Forma del nodo AST NewExpression:

  • callee: Expression | Super | V8IntrinsicIdentifier (obbligatorio)

  • arguments: (Expression | SpreadElement | ArgumentPlaceholder)[] (obbligatorio)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeArguments: TypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

  • typeParameters: TSTypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

Alias: Standardized, Expression


noop

JavaScript
t.noop();

Vedi anche t.isNoop(node, opts) e t.assertNoop(node, opts).

Alias: Miscellaneous


nullLiteral

JavaScript
t.nullLiteral();

Vedi anche t.isNullLiteral(node, opts) e t.assertNullLiteral(node, opts).

Alias: Standardized, Expression, Pureish, Literal, Immutable


nullLiteralTypeAnnotation

JavaScript
t.nullLiteralTypeAnnotation();

Vedi anche t.isNullLiteralTypeAnnotation(node, opts) e t.assertNullLiteralTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


nullableTypeAnnotation

JavaScript
t.nullableTypeAnnotation(typeAnnotation);

Vedi anche t.isNullableTypeAnnotation(node, opts) e t.assertNullableTypeAnnotation(node, opts).

Forma del nodo AST NullableTypeAnnotation:

  • typeAnnotation: FlowType (obbligatorio)

Alias: Flow, FlowType


numberLiteralTypeAnnotation

JavaScript
t.numberLiteralTypeAnnotation(value);

Vedi anche t.isNumberLiteralTypeAnnotation(node, opts) e t.assertNumberLiteralTypeAnnotation(node, opts).

Forma del nodo AST NumberLiteralTypeAnnotation:

  • value: number (obbligatorio)

Alias: Flow, FlowType


numberTypeAnnotation

JavaScript
t.numberTypeAnnotation();

Vedi anche t.isNumberTypeAnnotation(node, opts) e t.assertNumberTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


numericLiteral

JavaScript
t.numericLiteral(value);

Vedi anche t.isNumericLiteral(node, opts) e t.assertNumericLiteral(node, opts).

Forma del nodo AST NumericLiteral:

  • value: un number finito non negativo (obbligatorio)

Alias: Standardized, Expression, Pureish, Literal, Immutable


objectExpression

JavaScript
t.objectExpression(properties);

Vedi anche t.isObjectExpression(node, opts) e t.assertObjectExpression(node, opts).

Forma del nodo AST ObjectExpression:

  • properties: (ObjectMethod | ObjectProperty | SpreadElement)[] (obbligatorio)

Alias: Standardized, Expression


objectMethod

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

Vedi anche t.isObjectMethod(node, opts) e t.assertObjectMethod(node, opts).

Forma del nodo AST ObjectMethod:

  • kind: "method" | "get" | "set" (predefinito: 'method')

  • key: se computed allora Expression altrimenti Identifier | Literal (obbligatorio)

  • params: FunctionParameter[] (obbligatorio)

  • body: BlockStatement (obbligatorio)

  • computed: boolean (predefinito: false)

  • generator: boolean (predefinito: false)

  • async: boolean (predefinito: false)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • returnType: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

  • typeParameters: TypeParameterDeclaration | TSTypeParameterDeclaration | Noop (predefinito: null, escluso dalla funzione builder)

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


objectPattern

JavaScript
t.objectPattern(properties);

Vedi anche t.isObjectPattern(node, opts) e t.assertObjectPattern(node, opts).

Forma del nodo AST ObjectPattern:

  • properties: (RestElement | ObjectProperty)[] (obbligatorio)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, FunctionParameter, Pattern, PatternLike, LVal


objectProperty

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

Vedi anche t.isObjectProperty(node, opts) e t.assertObjectProperty(node, opts).

Forma del nodo AST ObjectProperty:

  • key: se computed allora Expression altrimenti Identifier | Literal (obbligatorio)

  • value: Expression | PatternLike (obbligatorio)

  • computed: boolean (predefinito: false)

  • shorthand: boolean (predefinito: false)

  • decorators: Decorator[] (predefinito: null)

Alias: Standardized, UserWhitespacable, Property, ObjectMember


objectTypeAnnotation

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

Vedi anche t.isObjectTypeAnnotation(node, opts) e t.assertObjectTypeAnnotation(node, opts).

Forma del nodo AST ObjectTypeAnnotation:

  • properties: (ObjectTypeProperty | ObjectTypeSpreadProperty)[] (obbligatorio)

  • indexers: ObjectTypeIndexer[] (predefinito: [])

  • callProperties: ObjectTypeCallProperty[] (predefinito: [])

  • internalSlots: ObjectTypeInternalSlot[] (predefinito: [])

  • exact: boolean (predefinito: false)

  • inexact: boolean (predefinito: null, escluso dalla funzione builder)

Alias: Flow, FlowType


objectTypeCallProperty

JavaScript
t.objectTypeCallProperty(value);

Vedi anche t.isObjectTypeCallProperty(node, opts) e t.assertObjectTypeCallProperty(node, opts).

Forma del nodo AST ObjectTypeCallProperty:

  • value: FlowType (obbligatorio)

  • static: boolean (obbligatorio)

Alias: Flow, UserWhitespacable


objectTypeIndexer

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

Vedi anche t.isObjectTypeIndexer(node, opts) e t.assertObjectTypeIndexer(node, opts).

Forma del nodo AST ObjectTypeIndexer:

  • id: Identifier (default: null)

  • key: FlowType (obbligatorio)

  • value: FlowType (obbligatorio)

  • variance: Variance (predefinito: null)

  • static: boolean (obbligatorio)

Alias: Flow, UserWhitespacable


objectTypeInternalSlot

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

Vedi anche t.isObjectTypeInternalSlot(node, opts) e t.assertObjectTypeInternalSlot(node, opts).

Forma del nodo AST ObjectTypeInternalSlot:

  • id: Identifier (obbligatorio)

  • value: FlowType (obbligatorio)

  • optional: boolean (obbligatorio)

  • static: boolean (obbligatorio)

  • method: boolean (obbligatorio)

Alias: Flow, UserWhitespacable


objectTypeProperty

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

Vedi anche t.isObjectTypeProperty(node, opts) e t.assertObjectTypeProperty(node, opts).

Forma del nodo AST ObjectTypeProperty:

  • key: Identifier | StringLiteral (obbligatorio)

  • value: FlowType (obbligatorio)

  • variance: Variance (predefinito: null)

  • kind: "init" | "get" | "set" (obbligatorio)

  • method: boolean (obbligatorio)

  • optional: boolean (obbligatorio)

  • proto: boolean (obbligatorio)

  • static: boolean (obbligatorio)

Alias: Flow, UserWhitespacable


objectTypeSpreadProperty

JavaScript
t.objectTypeSpreadProperty(argument);

Vedi anche t.isObjectTypeSpreadProperty(node, opts) e t.assertObjectTypeSpreadProperty(node, opts).

Forma del nodo AST ObjectTypeSpreadProperty:

  • argument: FlowType (obbligatorio)

Alias: Flow, UserWhitespacable


opaqueType

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

Vedi anche t.isOpaqueType(node, opts) e t.assertOpaqueType(node, opts).

Forma del nodo AST OpaqueType:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • supertype: FlowType (predefinito: null)

  • impltype: FlowType (obbligatorio)

Alias: Flow, FlowDeclaration, Statement, Declaration


optionalCallExpression

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

Vedi anche t.isOptionalCallExpression(node, opts) e t.assertOptionalCallExpression(node, opts).

Struttura nodo AST OptionalCallExpression:

  • callee: Expression (obbligatorio)

  • arguments: (Expression | SpreadElement | ArgumentPlaceholder)[] (obbligatorio)

  • optional: boolean (obbligatorio)

  • typeArguments: TypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

  • typeParameters: TSTypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

Alias: Standardized, Expression


optionalIndexedAccessType

JavaScript
t.optionalIndexedAccessType(objectType, indexType);

Vedi anche t.isOptionalIndexedAccessType(node, opts) e t.assertOptionalIndexedAccessType(node, opts).

Struttura nodo AST OptionalIndexedAccessType:

  • objectType: FlowType (obbligatorio)

  • indexType: FlowType (obbligatorio)

  • optional: boolean (obbligatorio)

Alias: Flow, FlowType


optionalMemberExpression

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

Vedi anche t.isOptionalMemberExpression(node, opts) e t.assertOptionalMemberExpression(node, opts).

Struttura nodo AST OptionalMemberExpression:

  • object: Expression (obbligatorio)

  • property: Expression | Identifier (obbligatorio)

  • computed: boolean (predefinito: false)

  • optional: boolean (obbligatorio)

Alias: Standardized, Expression


parenthesizedExpression

JavaScript
t.parenthesizedExpression(expression);

Vedi anche t.isParenthesizedExpression(node, opts) e t.assertParenthesizedExpression(node, opts).

Struttura nodo AST ParenthesizedExpression:

  • expression: Expression (obbligatorio)

Alias: Standardized, Expression, ExpressionWrapper


pipelineBareFunction

JavaScript
t.pipelineBareFunction(callee);

Vedi anche t.isPipelineBareFunction(node, opts) e t.assertPipelineBareFunction(node, opts).

Struttura nodo AST PipelineBareFunction:

  • callee: Expression (obbligatorio)

Alias: Expression


pipelinePrimaryTopicReference

JavaScript
t.pipelinePrimaryTopicReference();

Vedi anche t.isPipelinePrimaryTopicReference(node, opts) e t.assertPipelinePrimaryTopicReference(node, opts).

Alias: Expression


pipelineTopicExpression

JavaScript
t.pipelineTopicExpression(expression);

Vedi anche t.isPipelineTopicExpression(node, opts) e t.assertPipelineTopicExpression(node, opts).

Struttura nodo AST PipelineTopicExpression:

  • expression: Expression (obbligatorio)

Alias: Expression


segnaposto

JavaScript
t.placeholder(expectedNode, name);

Vedi anche t.isPlaceholder(node, opts) e t.assertPlaceholder(node, opts).

Forma del nodo AST Placeholder:

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

  • name: Identifier (obbligatorio)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Miscellaneous


nome privato

JavaScript
t.privateName(id);

Vedi anche t.isPrivateName(node, opts) e t.assertPrivateName(node, opts).

Forma del nodo AST PrivateName:

  • id: Identifier (obbligatorio)

Alias: Standardized, Private


programma

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

Vedi anche t.isProgram(node, opts) e t.assertProgram(node, opts).

Forma del nodo AST Program:

  • body: Statement[] (obbligatorio)

  • directives: Directive[] (predefinito: [])

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

  • interpreter: InterpreterDirective (default: null)

Alias: Standardized, Scopable, BlockParent, Block


identificatore di tipo qualificato

JavaScript
t.qualifiedTypeIdentifier(id, qualification);

Vedi anche t.isQualifiedTypeIdentifier(node, opts) e t.assertQualifiedTypeIdentifier(node, opts).

Forma del nodo AST QualifiedTypeIdentifier:

  • id: Identifier (obbligatorio)

  • qualification: Identifier | QualifiedTypeIdentifier (obbligatorio)

Alias: Flow


espressione record

JavaScript
t.recordExpression(properties);

Vedi anche t.isRecordExpression(node, opts) e t.assertRecordExpression(node, opts).

Forma del nodo AST RecordExpression:

  • properties: (ObjectProperty | SpreadElement)[] (obbligatorio)

Alias: Expression


letterale regex

JavaScript
t.regExpLiteral(pattern, flags);

Vedi anche t.isRegExpLiteral(node, opts) e t.assertRegExpLiteral(node, opts).

Forma del nodo AST RegExpLiteral:

  • pattern: string (obbligatorio)

  • flags: string (default: '')

Alias: Standardized, Expression, Pureish, Literal


elemento rest

JavaScript
t.restElement(argument);

Vedi anche t.isRestElement(node, opts) e t.assertRestElement(node, opts).

Struttura del nodo AST RestElement:

  • argument: Identifier | ArrayPattern | ObjectPattern | MemberExpression | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | RestElement | AssignmentPattern (obbligatorio)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, FunctionParameter, PatternLike, LVal


returnStatement

JavaScript
t.returnStatement(argument);

Vedi anche t.isReturnStatement(node, opts) e t.assertReturnStatement(node, opts).

Struttura del nodo AST ReturnStatement:

  • argument: Expression (default: null)

Alias: Standardized, Statement, Terminatorless, CompletionStatement


sequenceExpression

JavaScript
t.sequenceExpression(expressions);

Vedi anche t.isSequenceExpression(node, opts) e t.assertSequenceExpression(node, opts).

Struttura del nodo AST SequenceExpression:

  • expressions: Expression[] (obbligatorio)

Alias: Standardized, Expression


spreadElement

JavaScript
t.spreadElement(argument);

Vedi anche t.isSpreadElement(node, opts) e t.assertSpreadElement(node, opts).

Struttura del nodo AST SpreadElement:

  • argument: Expression (obbligatorio)

Alias: Standardized, UnaryLike


staticBlock

JavaScript
t.staticBlock(body);

Vedi anche t.isStaticBlock(node, opts) e t.assertStaticBlock(node, opts).

Struttura del nodo AST StaticBlock:

  • body: Statement[] (obbligatorio)

Alias: Standardized, Scopable, BlockParent, FunctionParent


stringLiteral

JavaScript
t.stringLiteral(value);

Vedi anche t.isStringLiteral(node, opts) e t.assertStringLiteral(node, opts).

Struttura del nodo AST StringLiteral:

  • value: string (obbligatorio)

Alias: Standardized, Expression, Pureish, Literal, Immutable


stringLiteralTypeAnnotation

JavaScript
t.stringLiteralTypeAnnotation(value);

Vedi anche t.isStringLiteralTypeAnnotation(node, opts) e t.assertStringLiteralTypeAnnotation(node, opts).

Struttura del nodo AST StringLiteralTypeAnnotation:

  • value: string (obbligatorio)

Alias: Flow, FlowType


stringTypeAnnotation

JavaScript
t.stringTypeAnnotation();

Vedi anche t.isStringTypeAnnotation(node, opts) e t.assertStringTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


super

JavaScript
t.super();

Vedi anche t.isSuper(node, opts) e t.assertSuper(node, opts).

Alias: Standardized, Expression


switchCase

JavaScript
t.switchCase(test, consequent);

Vedi anche t.isSwitchCase(node, opts) e t.assertSwitchCase(node, opts).

Struttura del nodo AST SwitchCase:

  • test: Expression (predefinito: null)

  • consequent: Statement[] (obbligatorio)

Alias: Standardized


switchStatement

JavaScript
t.switchStatement(discriminant, cases);

Vedi anche t.isSwitchStatement(node, opts) e t.assertSwitchStatement(node, opts).

Struttura del nodo AST SwitchStatement:

  • discriminant: Expression (obbligatorio)

  • cases: SwitchCase[] (obbligatorio)

Alias: Standardized, Statement, BlockParent, Scopable


symbolTypeAnnotation

JavaScript
t.symbolTypeAnnotation();

Vedi anche t.isSymbolTypeAnnotation(node, opts) e t.assertSymbolTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


tsAnyKeyword

JavaScript
t.tsAnyKeyword();

Vedi anche t.isTSAnyKeyword(node, opts) e t.assertTSAnyKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsArrayType

JavaScript
t.tsArrayType(elementType);

Vedi anche t.isTSArrayType(node, opts) e t.assertTSArrayType(node, opts).

Struttura del nodo AST TSArrayType:

  • elementType: TSType (obbligatorio)

Alias: TypeScript, TSType


tsAsExpression

JavaScript
t.tsAsExpression(expression, typeAnnotation);

Vedi anche t.isTSAsExpression(node, opts) e t.assertTSAsExpression(node, opts).

Struttura del nodo AST TSAsExpression:

  • expression: Expression (obbligatorio)

  • typeAnnotation: TSType (obbligatorio)

Alias: TypeScript, Expression, LVal, PatternLike


tsBigIntKeyword

JavaScript
t.tsBigIntKeyword();

Vedi anche t.isTSBigIntKeyword(node, opts) e t.assertTSBigIntKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsBooleanKeyword

JavaScript
t.tsBooleanKeyword();

Vedi anche t.isTSBooleanKeyword(node, opts) e t.assertTSBooleanKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsCallSignatureDeclaration

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

Vedi anche t.isTSCallSignatureDeclaration(node, opts) e t.assertTSCallSignatureDeclaration(node, opts).

Forma del nodo AST TSCallSignatureDeclaration:

  • typeParameters: TSTypeParameterDeclaration (predefinito: null)

  • parameters: (ArrayPattern | Identifier | ObjectPattern | RestElement)[] (obbligatorio)

  • typeAnnotation: TSTypeAnnotation (default: null)

Alias: TypeScript, TSTypeElement


tsConditionalType

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

Vedi anche t.isTSConditionalType(node, opts) e t.assertTSConditionalType(node, opts).

Forma del nodo AST TSConditionalType:

  • checkType: TSType (required)

  • extendsType: TSType (required)

  • trueType: TSType (required)

  • falseType: TSType (required)

Alias: TypeScript, TSType


tsConstructSignatureDeclaration

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

Vedi anche t.isTSConstructSignatureDeclaration(node, opts) e t.assertTSConstructSignatureDeclaration(node, opts).

Forma del nodo AST TSConstructSignatureDeclaration:

  • typeParameters: TSTypeParameterDeclaration (predefinito: null)

  • parameters: (ArrayPattern | Identifier | ObjectPattern | RestElement)[] (obbligatorio)

  • typeAnnotation: TSTypeAnnotation (default: null)

Alias: TypeScript, TSTypeElement


tsConstructorType

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

Vedi anche t.isTSConstructorType(node, opts) e t.assertTSConstructorType(node, opts).

Forma del nodo AST TSConstructorType:

  • typeParameters: TSTypeParameterDeclaration (predefinito: null)

  • parameters: (ArrayPattern | Identifier | ObjectPattern | RestElement)[] (obbligatorio)

  • typeAnnotation: TSTypeAnnotation (default: null)

  • abstract: boolean (valore predefinito: null, escluso dalla funzione di costruzione)

Alias: TypeScript, TSType


tsDeclareFunction

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

Vedi anche t.isTSDeclareFunction(node, opts) e t.assertTSDeclareFunction(node, opts).

Forma del nodo AST TSDeclareFunction:

  • id: Identifier (default: null)

  • typeParameters: TSTypeParameterDeclaration | Noop (valore predefinito: null)

  • params: FunctionParameter[] (obbligatorio)

  • returnType: TSTypeAnnotation | Noop (valore predefinito: null)

  • async: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

  • generator: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

Alias: TypeScript, Statement, Declaration


tsDeclareMethod

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

Vedi anche t.isTSDeclareMethod(node, opts) e t.assertTSDeclareMethod(node, opts).

Forma del nodo AST TSDeclareMethod:

  • decorators: Decorator[] (predefinito: null)

  • key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression (obbligatorio)

  • typeParameters: TSTypeParameterDeclaration | Noop (valore predefinito: null)

  • params: (FunctionParameter | TSParameterProperty)[] (obbligatorio)

  • returnType: TSTypeAnnotation | Noop (valore predefinito: null)

  • abstract: boolean (valore predefinito: null, escluso dalla funzione di costruzione)

  • access: "public" | "private" | "protected" (valore predefinito: null, escluso dalla funzione di costruzione)

  • accessibility: "public" | "private" | "protected" (predefinito: null, escluso dalla funzione builder)

  • async: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • computed: boolean (predefinito: false, escluso dalla funzione builder)

  • generator: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • kind: "get" | "set" | "method" | "constructor" (valore predefinito: 'method', escluso dalla funzione di costruzione)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • override: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

  • static: boolean (valore predefinito: false, escluso dalla funzione di costruzione)

Alias: TypeScript


tsEnumBody

JavaScript
t.tsEnumBody(members);

Vedi anche t.isTSEnumBody(node, opts) e t.assertTSEnumBody(node, opts).

Forma del nodo AST TSEnumBody:

  • members: TSEnumMember[] (obbligatorio)

Alias: TypeScript


tsEnumDeclaration

JavaScript
t.tsEnumDeclaration(id, members);

Vedi anche t.isTSEnumDeclaration(node, opts) e t.assertTSEnumDeclaration(node, opts).

Forma del nodo AST TSEnumDeclaration:

  • id: Identifier (obbligatorio)

  • members: TSEnumMember[] (obbligatorio)

  • body: TSEnumBody (valore predefinito: null, escluso dalla funzione di costruzione)

  • const: boolean (predefinito: null, escluso dalla funzione builder)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

  • initializer: Expression (valore predefinito: null, escluso dalla funzione di costruzione)

Alias: TypeScript, Statement, Declaration


tsEnumMember

JavaScript
t.tsEnumMember(id, initializer);

Vedi anche t.isTSEnumMember(node, opts) e t.assertTSEnumMember(node, opts).

Struttura del nodo AST TSEnumMember:

  • id: Identifier | StringLiteral (obbligatorio)

  • initializer: Expression (default: null)

Alias: TypeScript


tsExportAssignment

JavaScript
t.tsExportAssignment(expression);

Vedi anche t.isTSExportAssignment(node, opts) e t.assertTSExportAssignment(node, opts).

Struttura del nodo AST TSExportAssignment:

  • expression: Expression (obbligatorio)

Alias: TypeScript, Statement


tsExpressionWithTypeArguments

JavaScript
t.tsExpressionWithTypeArguments(expression, typeParameters);

Vedi anche t.isTSExpressionWithTypeArguments(node, opts) e t.assertTSExpressionWithTypeArguments(node, opts).

Struttura del nodo AST TSExpressionWithTypeArguments:

  • expression: TSEntityName (obbligatorio)

  • typeParameters: TSTypeParameterInstantiation (default: null)

Alias: TypeScript, TSType


tsExternalModuleReference

JavaScript
t.tsExternalModuleReference(expression);

Vedi anche t.isTSExternalModuleReference(node, opts) e t.assertTSExternalModuleReference(node, opts).

Struttura del nodo AST TSExternalModuleReference:

  • expression: StringLiteral (obbligatorio)

Alias: TypeScript


tsFunctionType

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

Vedi anche t.isTSFunctionType(node, opts) e t.assertTSFunctionType(node, opts).

Struttura del nodo AST TSFunctionType:

  • typeParameters: TSTypeParameterDeclaration (predefinito: null)

  • parameters: (ArrayPattern | Identifier | ObjectPattern | RestElement)[] (obbligatorio)

  • typeAnnotation: TSTypeAnnotation (default: null)

Alias: TypeScript, TSType


tsImportEqualsDeclaration

JavaScript
t.tsImportEqualsDeclaration(id, moduleReference);

Vedi anche t.isTSImportEqualsDeclaration(node, opts) e t.assertTSImportEqualsDeclaration(node, opts).

Struttura del nodo AST TSImportEqualsDeclaration:

  • id: Identifier (obbligatorio)

  • moduleReference: TSEntityName | TSExternalModuleReference (obbligatorio)

  • importKind: "type" | "value" (default: null, escluso dalla funzione di costruzione)

  • isExport: boolean (obbligatorio)

Alias: TypeScript, Statement, Declaration


tsImportType

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

Vedi anche t.isTSImportType(node, opts) e t.assertTSImportType(node, opts).

Struttura del nodo AST TSImportType:

  • argument: StringLiteral (obbligatorio)

  • qualifier: TSEntityName (predefinito: null)

  • typeParameters: TSTypeParameterInstantiation (default: null)

  • options: ObjectExpression (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript, TSType


tsIndexSignature

JavaScript
t.tsIndexSignature(parameters, typeAnnotation);

Vedi anche t.isTSIndexSignature(node, opts) e t.assertTSIndexSignature(node, opts).

Forma del nodo AST TSIndexSignature:

  • parameters: Identifier[] (obbligatorio)

  • typeAnnotation: TSTypeAnnotation (default: null)

  • readonly: boolean (predefinito: null, escluso dalla funzione builder)

  • static: boolean (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript, TSTypeElement


tsIndexedAccessType

JavaScript
t.tsIndexedAccessType(objectType, indexType);

Vedi anche t.isTSIndexedAccessType(node, opts) e t.assertTSIndexedAccessType(node, opts).

Forma del nodo AST TSIndexedAccessType:

  • objectType: TSType (obbligatorio)

  • indexType: TSType (obbligatorio)

Alias: TypeScript, TSType


tsInferType

JavaScript
t.tsInferType(typeParameter);

Vedi anche t.isTSInferType(node, opts) e t.assertTSInferType(node, opts).

Forma del nodo AST TSInferType:

  • typeParameter: TSTypeParameter (obbligatorio)

Alias: TypeScript, TSType


tsInstantiationExpression

JavaScript
t.tsInstantiationExpression(expression, typeParameters);

Vedi anche t.isTSInstantiationExpression(node, opts) e t.assertTSInstantiationExpression(node, opts).

Forma del nodo AST TSInstantiationExpression:

  • expression: Expression (obbligatorio)

  • typeParameters: TSTypeParameterInstantiation (default: null)

Alias: TypeScript, Expression


tsInterfaceBody

JavaScript
t.tsInterfaceBody(body);

Vedi anche t.isTSInterfaceBody(node, opts) e t.assertTSInterfaceBody(node, opts).

Forma del nodo AST TSInterfaceBody:

  • body: TSTypeElement[] (obbligatorio)

Alias: TypeScript


tsInterfaceDeclaration

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

Vedi anche t.isTSInterfaceDeclaration(node, opts) e t.assertTSInterfaceDeclaration(node, opts).

Forma del nodo AST TSInterfaceDeclaration:

  • id: Identifier (obbligatorio)

  • typeParameters: TSTypeParameterDeclaration (predefinito: null)

  • extends: TSExpressionWithTypeArguments[] (predefinito: null)

  • body: TSInterfaceBody (obbligatorio)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript, Statement, Declaration


tsIntersectionType

JavaScript
t.tsIntersectionType(types);

Vedi anche t.isTSIntersectionType(node, opts) e t.assertTSIntersectionType(node, opts).

Forma del nodo AST TSIntersectionType:

  • types: TSType[] (obbligatorio)

Alias: TypeScript, TSType


tsIntrinsicKeyword

JavaScript
t.tsIntrinsicKeyword();

Vedi anche t.isTSIntrinsicKeyword(node, opts) e t.assertTSIntrinsicKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsLiteralType

JavaScript
t.tsLiteralType(literal);

Vedi anche t.isTSLiteralType(node, opts) e t.assertTSLiteralType(node, opts).

Forma del nodo AST TSLiteralType:

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

Alias: TypeScript, TSType, TSBaseType


tsMappedType

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

Vedi anche t.isTSMappedType(node, opts) e t.assertTSMappedType(node, opts).

Forma del nodo AST TSMappedType:

  • typeParameter: TSTypeParameter (obbligatorio)

  • typeAnnotation: TSType (predefinito: null)

  • nameType: TSType (predefinito: null)

  • optional: true | false | "+" | "-" (predefinito: null, escluso dalla funzione di costruzione)

  • readonly: true | false | "+" | "-" (predefinito: null, escluso dalla funzione di costruzione)

Alias: TypeScript, TSType


tsMethodSignature

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

Vedi anche t.isTSMethodSignature(node, opts) e t.assertTSMethodSignature(node, opts).

Forma del nodo AST TSMethodSignature:

  • key: Expression (richiesto)

  • typeParameters: TSTypeParameterDeclaration (predefinito: null)

  • parameters: (ArrayPattern | Identifier | ObjectPattern | RestElement)[] (obbligatorio)

  • typeAnnotation: TSTypeAnnotation (default: null)

  • computed: boolean (predefinito: false, escluso dalla funzione builder)

  • kind: "method" | "get" | "set" (obbligatorio)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript, TSTypeElement


tsModuleBlock

JavaScript
t.tsModuleBlock(body);

Vedi anche t.isTSModuleBlock(node, opts) e t.assertTSModuleBlock(node, opts).

Forma del nodo AST TSModuleBlock:

  • body: Statement[] (obbligatorio)

Alias: TypeScript, Scopable, Block, BlockParent, FunctionParent


tsModuleDeclaration

JavaScript
t.tsModuleDeclaration(id, body);

Vedi anche t.isTSModuleDeclaration(node, opts) e t.assertTSModuleDeclaration(node, opts).

Forma del nodo AST TSModuleDeclaration:

  • id: Identifier | StringLiteral (obbligatorio)

  • body: TSModuleBlock | TSModuleDeclaration (obbligatorio)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

  • global: boolean (predefinito: null, escluso dalla funzione builder)

  • kind: "global" | "module" | "namespace" (obbligatorio)

Alias: TypeScript, Statement, Declaration


tsNamedTupleMember

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

Vedi anche t.isTSNamedTupleMember(node, opts) e t.assertTSNamedTupleMember(node, opts).

Forma del nodo AST TSNamedTupleMember:

  • label: Identifier (obbligatorio)

  • elementType: TSType (obbligatorio)

  • optional: boolean (predefinito: false)

Alias: TypeScript


tsNamespaceExportDeclaration

JavaScript
t.tsNamespaceExportDeclaration(id);

Vedi anche t.isTSNamespaceExportDeclaration(node, opts) e t.assertTSNamespaceExportDeclaration(node, opts).

Forma del nodo AST TSNamespaceExportDeclaration:

  • id: Identifier (obbligatorio)

Alias: TypeScript, Statement


tsNeverKeyword

JavaScript
t.tsNeverKeyword();

Vedi anche t.isTSNeverKeyword(node, opts) e t.assertTSNeverKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsNonNullExpression

JavaScript
t.tsNonNullExpression(expression);

Vedi anche t.isTSNonNullExpression(node, opts) e t.assertTSNonNullExpression(node, opts).

Forma del nodo AST TSNonNullExpression:

  • expression: Expression (obbligatorio)

Alias: TypeScript, Expression, LVal, PatternLike


tsNullKeyword

JavaScript
t.tsNullKeyword();

Vedi anche t.isTSNullKeyword(node, opts) e t.assertTSNullKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsNumberKeyword

JavaScript
t.tsNumberKeyword();

Vedi anche t.isTSNumberKeyword(node, opts) e t.assertTSNumberKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsObjectKeyword

JavaScript
t.tsObjectKeyword();

Vedi anche t.isTSObjectKeyword(node, opts) e t.assertTSObjectKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsOptionalType

JavaScript
t.tsOptionalType(typeAnnotation);

Vedi anche t.isTSOptionalType(node, opts) e t.assertTSOptionalType(node, opts).

Struttura del nodo AST TSOptionalType:

  • typeAnnotation: TSType (obbligatorio)

Alias: TypeScript, TSType


tsParameterProperty

JavaScript
t.tsParameterProperty(parameter);

Vedi anche t.isTSParameterProperty(node, opts) e t.assertTSParameterProperty(node, opts).

Struttura del nodo AST TSParameterProperty:

  • parameter: Identifier | AssignmentPattern (richiesto)

  • accessibility: "public" | "private" | "protected" (predefinito: null, escluso dalla funzione builder)

  • decorators: Decorator[] (predefinito: null, escluso dalla funzione builder)

  • override: boolean (predefinito: null, escluso dalla funzione builder)

  • readonly: boolean (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript, LVal


tsParenthesizedType

JavaScript
t.tsParenthesizedType(typeAnnotation);

Vedi anche t.isTSParenthesizedType(node, opts) e t.assertTSParenthesizedType(node, opts).

Struttura del nodo AST TSParenthesizedType:

  • typeAnnotation: TSType (obbligatorio)

Alias: TypeScript, TSType


tsPropertySignature

JavaScript
t.tsPropertySignature(key, typeAnnotation);

Vedi anche t.isTSPropertySignature(node, opts) e t.assertTSPropertySignature(node, opts).

Struttura del nodo AST TSPropertySignature:

  • key: Expression (richiesto)

  • typeAnnotation: TSTypeAnnotation (default: null)

  • computed: boolean (predefinito: false, escluso dalla funzione builder)

  • kind: "get" | "set" (predefinito: null, escluso dalla funzione builder)

  • optional: boolean (predefinito: null, escluso dalla funzione builder)

  • readonly: boolean (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript, TSTypeElement


tsQualifiedName

JavaScript
t.tsQualifiedName(left, right);

Vedi anche t.isTSQualifiedName(node, opts) e t.assertTSQualifiedName(node, opts).

Struttura del nodo AST TSQualifiedName:

  • left: TSEntityName (richiesto)

  • right: Identifier (richiesto)

Alias: TypeScript, TSEntityName


tsRestType

JavaScript
t.tsRestType(typeAnnotation);

Vedi anche t.isTSRestType(node, opts) e t.assertTSRestType(node, opts).

Forma del nodo AST TSRestType:

  • typeAnnotation: TSType (obbligatorio)

Alias: TypeScript, TSType


tsSatisfiesExpression

JavaScript
t.tsSatisfiesExpression(expression, typeAnnotation);
History
VersionChanges
v7.20.0Introduced

Vedi anche t.isTSSatisfiesExpression(node, opts) e t.assertTSSatisfiesExpression(node, opts).

Forma del nodo AST TSSatisfiesExpression:

  • expression: Expression (obbligatorio)

  • typeAnnotation: TSType (obbligatorio)

Alias: TypeScript, Expression, LVal, PatternLike


tsStringKeyword

JavaScript
t.tsStringKeyword();

Vedi anche t.isTSStringKeyword(node, opts) e t.assertTSStringKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsSymbolKeyword

JavaScript
t.tsSymbolKeyword();

Vedi anche t.isTSSymbolKeyword(node, opts) e t.assertTSSymbolKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsTemplateLiteralType

JavaScript
t.tsTemplateLiteralType(quasis, types);

Vedi anche t.isTSTemplateLiteralType(node, opts) e t.assertTSTemplateLiteralType(node, opts).

Forma del nodo AST TSTemplateLiteralType:

  • quasis: TemplateElement[] (obbligatorio)

  • types: TSType[] (obbligatorio)

Alias: TypeScript, TSType, TSBaseType


tsThisType

JavaScript
t.tsThisType();

Vedi anche t.isTSThisType(node, opts) e t.assertTSThisType(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsTupleType

JavaScript
t.tsTupleType(elementTypes);

Vedi anche t.isTSTupleType(node, opts) e t.assertTSTupleType(node, opts).

Forma del nodo AST TSTupleType:

  • elementTypes: (TSType | TSNamedTupleMember)[] (obbligatorio)

Alias: TypeScript, TSType


tsTypeAliasDeclaration

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

Vedi anche t.isTSTypeAliasDeclaration(node, opts) e t.assertTSTypeAliasDeclaration(node, opts).

Forma del nodo AST TSTypeAliasDeclaration:

  • id: Identifier (obbligatorio)

  • typeParameters: TSTypeParameterDeclaration (predefinito: null)

  • typeAnnotation: TSType (obbligatorio)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript, Statement, Declaration


tsTypeAnnotation

JavaScript
t.tsTypeAnnotation(typeAnnotation);

Vedi anche t.isTSTypeAnnotation(node, opts) e t.assertTSTypeAnnotation(node, opts).

Struttura del nodo AST TSTypeAnnotation:

  • typeAnnotation: TSType (obbligatorio)

Alias: TypeScript


tsTypeAssertion

JavaScript
t.tsTypeAssertion(typeAnnotation, expression);

Vedi anche t.isTSTypeAssertion(node, opts) e t.assertTSTypeAssertion(node, opts).

Struttura del nodo AST TSTypeAssertion:

  • typeAnnotation: TSType (obbligatorio)

  • expression: Expression (obbligatorio)

Alias: TypeScript, Expression, LVal, PatternLike


tsTypeLiteral

JavaScript
t.tsTypeLiteral(members);

Vedi anche t.isTSTypeLiteral(node, opts) e t.assertTSTypeLiteral(node, opts).

Struttura del nodo AST TSTypeLiteral:

  • members: TSTypeElement[] (obbligatorio)

Alias: TypeScript, TSType


tsTypeOperator

JavaScript
t.tsTypeOperator(typeAnnotation, operator);

Vedi anche t.isTSTypeOperator(node, opts) e t.assertTSTypeOperator(node, opts).

Struttura del nodo AST TSTypeOperator:

  • typeAnnotation: TSType (obbligatorio)

  • operator: string (predefinito: 'keyof')

Alias: TypeScript, TSType


tsTypeParameter

JavaScript
t.tsTypeParameter(constraint, default, name);
History
VersionChanges
v7.21.0Supports const

Vedi anche t.isTSTypeParameter(node, opts) e t.assertTSTypeParameter(node, opts).

Struttura del nodo AST TSTypeParameter:

  • constraint: TSType (predefinito: null)

  • default: TSType (predefinito: null)

  • name: string (obbligatorio)

  • const: boolean (predefinito: null, escluso dalla funzione builder)

  • in: boolean (predefinito: null, escluso dalla funzione builder)

  • out: boolean (predefinito: null, escluso dalla funzione builder)

Alias: TypeScript


tsTypeParameterDeclaration

JavaScript
t.tsTypeParameterDeclaration(params);

Vedi anche t.isTSTypeParameterDeclaration(node, opts) e t.assertTSTypeParameterDeclaration(node, opts).

Struttura del nodo AST TSTypeParameterDeclaration:

  • params: TSTypeParameter[] (obbligatorio)

Alias: TypeScript


tsTypeParameterInstantiation

JavaScript
t.tsTypeParameterInstantiation(params);

Vedi anche t.isTSTypeParameterInstantiation(node, opts) e t.assertTSTypeParameterInstantiation(node, opts).

Struttura del nodo AST TSTypeParameterInstantiation:

  • params: TSType[] (obbligatorio)

Alias: TypeScript


tsTypePredicate

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

Vedi anche t.isTSTypePredicate(node, opts) e t.assertTSTypePredicate(node, opts).

Struttura del nodo AST TSTypePredicate:

  • parameterName: Identifier | TSThisType (obbligatorio)

  • typeAnnotation: TSTypeAnnotation (default: null)

  • asserts: boolean (default: null)

Alias: TypeScript, TSType


tsTypeQuery

JavaScript
t.tsTypeQuery(exprName, typeParameters);

Vedi anche t.isTSTypeQuery(node, opts) e t.assertTSTypeQuery(node, opts).

Struttura del nodo AST TSTypeQuery:

  • exprName: TSEntityName | TSImportType (obbligatorio)

  • typeParameters: TSTypeParameterInstantiation (default: null)

Alias: TypeScript, TSType


tsTypeReference

JavaScript
t.tsTypeReference(typeName, typeParameters);

Vedi anche t.isTSTypeReference(node, opts) e t.assertTSTypeReference(node, opts).

Struttura del nodo AST TSTypeReference:

  • typeName: TSEntityName (obbligatorio)

  • typeParameters: TSTypeParameterInstantiation (default: null)

Alias: TypeScript, TSType


tsUndefinedKeyword

JavaScript
t.tsUndefinedKeyword();

Vedi anche t.isTSUndefinedKeyword(node, opts) e t.assertTSUndefinedKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsUnionType

JavaScript
t.tsUnionType(types);

Vedi anche t.isTSUnionType(node, opts) e t.assertTSUnionType(node, opts).

Struttura del nodo AST TSUnionType:

  • types: TSType[] (obbligatorio)

Alias: TypeScript, TSType


tsUnknownKeyword

JavaScript
t.tsUnknownKeyword();

Vedi anche t.isTSUnknownKeyword(node, opts) e t.assertTSUnknownKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


tsVoidKeyword

JavaScript
t.tsVoidKeyword();

Vedi anche t.isTSVoidKeyword(node, opts) e t.assertTSVoidKeyword(node, opts).

Alias: TypeScript, TSType, TSBaseType


Espressione di Template con Tag

JavaScript
t.taggedTemplateExpression(tag, quasi);

Vedi anche t.isTaggedTemplateExpression(node, opts) e t.assertTaggedTemplateExpression(node, opts).

Forma del nodo AST TaggedTemplateExpression:

  • tag: Expression (obbligatorio)

  • quasi: TemplateLiteral (obbligatorio)

  • typeParameters: TypeParameterInstantiation | TSTypeParameterInstantiation (predefinito: null, escluso dalla funzione di costruzione)

Alias: Standardized, Expression


Elemento Template

JavaScript
t.templateElement(value, tail);

Vedi anche t.isTemplateElement(node, opts) e t.assertTemplateElement(node, opts).

Forma del nodo AST TemplateElement:

  • value: { raw: string, cooked?: string } (obbligatorio)

  • tail: boolean (predefinito: false)

Alias: Standardized


Template Literal

JavaScript
t.templateLiteral(quasis, expressions);

Vedi anche t.isTemplateLiteral(node, opts) e t.assertTemplateLiteral(node, opts).

Forma del nodo AST TemplateLiteral:

  • quasis: TemplateElement[] (obbligatorio)

  • expressions: (Expression | TSType)[] (obbligatorio)

Alias: Standardized, Expression, Literal


Espressione This

JavaScript
t.thisExpression();

Vedi anche t.isThisExpression(node, opts) e t.assertThisExpression(node, opts).

Alias: Standardized, Expression


Annotazione del Tipo This

JavaScript
t.thisTypeAnnotation();

Vedi anche t.isThisTypeAnnotation(node, opts) e t.assertThisTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


Istruzione Throw

JavaScript
t.throwStatement(argument);

Vedi anche t.isThrowStatement(node, opts) e t.assertThrowStatement(node, opts).

Forma del nodo AST ThrowStatement:

  • argument: Expression (obbligatorio)

Alias: Standardized, Statement, Terminatorless, CompletionStatement


Riferimento all'Argomento

JavaScript
t.topicReference();

Vedi anche t.isTopicReference(node, opts) e t.assertTopicReference(node, opts).

Alias: Expression


Istruzione Try

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

Vedi anche t.isTryStatement(node, opts) e t.assertTryStatement(node, opts).

Forma del nodo AST TryStatement:

  • block: BlockStatement (obbligatorio)

  • handler: CatchClause (predefinito: null)

  • finalizer: BlockStatement (predefinito: null)

Alias: Standardized, Statement


Espressione Tupla

JavaScript
t.tupleExpression(elements);

Vedi anche t.isTupleExpression(node, opts) e t.assertTupleExpression(node, opts).

Forma del nodo AST TupleExpression:

  • elements: (Expression | SpreadElement)[] (predefinito: [])

Alias: Expression


tupleTypeAnnotation

JavaScript
t.tupleTypeAnnotation(types);

Vedi anche t.isTupleTypeAnnotation(node, opts) e t.assertTupleTypeAnnotation(node, opts).

Forma del nodo AST TupleTypeAnnotation:

  • types: FlowType[] (obbligatorio)

Alias: Flow, FlowType


typeAlias

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

Vedi anche t.isTypeAlias(node, opts) e t.assertTypeAlias(node, opts).

Forma del nodo AST TypeAlias:

  • id: Identifier (obbligatorio)

  • typeParameters: TypeParameterDeclaration (predefinito: null)

  • right: FlowType (obbligatorio)

Alias: Flow, FlowDeclaration, Statement, Declaration


typeAnnotation

JavaScript
t.typeAnnotation(typeAnnotation);

Vedi anche t.isTypeAnnotation(node, opts) e t.assertTypeAnnotation(node, opts).

Forma del nodo AST TypeAnnotation:

  • typeAnnotation: FlowType (obbligatorio)

Alias: Flow


typeCastExpression

JavaScript
t.typeCastExpression(expression, typeAnnotation);

Vedi anche t.isTypeCastExpression(node, opts) e t.assertTypeCastExpression(node, opts).

Forma del nodo AST TypeCastExpression:

  • expression: Expression (obbligatorio)

  • typeAnnotation: TypeAnnotation (obbligatorio)

Alias: Flow, ExpressionWrapper, Expression


typeParameter

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

Vedi anche t.isTypeParameter(node, opts) e t.assertTypeParameter(node, opts).

Forma del nodo AST TypeParameter:

  • bound: TypeAnnotation (predefinito: null)

  • default: FlowType (predefinito: null)

  • variance: Variance (predefinito: null)

  • name: string (obbligatorio)

Alias: Flow


typeParameterDeclaration

JavaScript
t.typeParameterDeclaration(params);

Vedi anche t.isTypeParameterDeclaration(node, opts) e t.assertTypeParameterDeclaration(node, opts).

Forma del nodo AST TypeParameterDeclaration:

  • params: TypeParameter[] (obbligatorio)

Alias: Flow


typeParameterInstantiation

JavaScript
t.typeParameterInstantiation(params);

Vedi anche t.isTypeParameterInstantiation(node, opts) e t.assertTypeParameterInstantiation(node, opts).

Forma del nodo AST TypeParameterInstantiation:

  • params: FlowType[] (obbligatorio)

Alias: Flow


typeofTypeAnnotation

JavaScript
t.typeofTypeAnnotation(argument);

Vedi anche t.isTypeofTypeAnnotation(node, opts) e t.assertTypeofTypeAnnotation(node, opts).

Forma del nodo AST TypeofTypeAnnotation:

  • argument: FlowType (obbligatorio)

Alias: Flow, FlowType


unaryExpression

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

Vedi anche t.isUnaryExpression(node, opts) e t.assertUnaryExpression(node, opts).

Forma del nodo AST UnaryExpression:

  • operator: "void" | "throw" | "delete" | "!" | "+" | "-" | "~" | "typeof" (obbligatorio)

  • argument: Expression (obbligatorio)

  • prefix: boolean (predefinito: true)

Alias: Standardized, UnaryLike, Expression


unionTypeAnnotation

JavaScript
t.unionTypeAnnotation(types);

Vedi anche t.isUnionTypeAnnotation(node, opts) e t.assertUnionTypeAnnotation(node, opts).

Forma del nodo AST UnionTypeAnnotation:

  • types: FlowType[] (obbligatorio)

Alias: Flow, FlowType


updateExpression

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

Vedi anche t.isUpdateExpression(node, opts) e t.assertUpdateExpression(node, opts).

Forma del nodo AST UpdateExpression:

  • operator: "++" | "--" (obbligatorio)

  • argument: Expression (obbligatorio)

  • prefix: boolean (predefinito: false)

Alias: Standardized, Expression


v8IntrinsicIdentifier

JavaScript
t.v8IntrinsicIdentifier(name);

Vedi anche t.isV8IntrinsicIdentifier(node, opts) e t.assertV8IntrinsicIdentifier(node, opts).

Forma del nodo AST V8IntrinsicIdentifier:

  • name: string (obbligatorio)

Alias: Miscellaneous


variableDeclaration

JavaScript
t.variableDeclaration(kind, declarations);
History
VersionChanges
v7.20.0kind can be "using".
v7.22.0kind can be "await using".

Vedi anche t.isVariableDeclaration(node, opts) e t.assertVariableDeclaration(node, opts).

Forma del nodo AST VariableDeclaration:

  • kind: "var" | "let" | "const" | "using" | "await using" (obbligatorio)

  • declarations: VariableDeclarator[] (obbligatorio)

  • declare: boolean (predefinito: null, escluso dalla funzione builder)

Alias: Standardized, Statement, Declaration


variableDeclarator

JavaScript
t.variableDeclarator(id, init);

Vedi anche t.isVariableDeclarator(node, opts) e t.assertVariableDeclarator(node, opts).

Forma del nodo AST VariableDeclarator:

  • id: LVal | VoidPattern (obbligatorio)

  • init: Expression (default: null)

  • definite: boolean (default: null, escluso dalla funzione builder)

Alias: Standardized


variance

JavaScript
t.variance(kind);

Vedi anche t.isVariance(node, opts) e t.assertVariance(node, opts).

Forma del nodo AST Variance:

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

Alias: Flow


voidPattern

JavaScript
t.voidPattern();
History
VersionChanges
v7.28.0Introduced

Vedi anche t.isVoidPattern(node, opts) e t.assertVoidPattern(node, opts).

Alias: Pattern, PatternLike, FunctionParameter


voidTypeAnnotation

JavaScript
t.voidTypeAnnotation();

Vedi anche t.isVoidTypeAnnotation(node, opts) e t.assertVoidTypeAnnotation(node, opts).

Alias: Flow, FlowType, FlowBaseAnnotation


whileStatement

JavaScript
t.whileStatement(test, body);

Vedi anche t.isWhileStatement(node, opts) e t.assertWhileStatement(node, opts).

Forma del nodo AST WhileStatement:

  • test: Expression (obbligatorio)

  • body: Statement (obbligatorio)

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


withStatement

JavaScript
t.withStatement(object, body);

Vedi anche t.isWithStatement(node, opts) e t.assertWithStatement(node, opts).

Forma del nodo AST WithStatement:

  • object: Expression (obbligatorio)

  • body: Statement (obbligatorio)

Alias: Standardized, Statement


yieldExpression

JavaScript
t.yieldExpression(argument, delegate);

Vedi anche t.isYieldExpression(node, opts) e t.assertYieldExpression(node, opts).

Forma del nodo AST YieldExpression:

  • argument: Expression (default: null)

  • delegate: boolean (default: false)

Alias: Standardized, Expression, Terminatorless


Alias

Accessor

Deprecato. Verrà rimosso in Babel 8.

JavaScript
t.isAccessor(node);

Nodi inclusi:

Binary

Copertura per BinaryExpression e LogicalExpression, che condividono la stessa forma AST.

JavaScript
t.isBinary(node);

Nodi inclusi:

Block

Deprecato. Verrà rimosso in Babel 8.

JavaScript
t.isBlock(node);

Nodi inclusi:

BlockParent

Copertura di nodi AST che iniziano un contesto di esecuzione con un nuovo LexicalEnvironment. In altre parole, definiscono l'ambito delle dichiarazioni let e const.

JavaScript
t.isBlockParent(node);

Nodi inclusi:

Class

Copertura di ClassExpression e ClassDeclaration, che condividono la stessa struttura AST.

JavaScript
t.isClass(node);

Nodi inclusi:

CompletionStatement

Istruzione che indica i record di completamento. In altre parole, definiscono il flusso di controllo del programma, ad esempio quando un ciclo deve interrompersi o un'azione genera errori critici.

JavaScript
t.isCompletionStatement(node);

Nodi inclusi:

Conditional

Copertura di ConditionalExpression e IfStatement, che condividono la stessa struttura AST.

JavaScript
t.isConditional(node);

Nodi inclusi:

Declaration

Copertura di qualsiasi Dichiarazione.

JavaScript
t.isDeclaration(node);

Nodi inclusi:

EnumBody

Una copertura dei corpi di enum di Flow.

JavaScript
t.isEnumBody(node);

Nodi inclusi:

EnumMember

Una copertura dei membri di enum di Flow.

JavaScript
t.isEnumMember(node);

Nodi inclusi:

ExportDeclaration

Una copertura per qualsiasi ExportDeclaration.

JavaScript
t.isExportDeclaration(node);

Nodi inclusi:

Expression

Una copertura per qualsiasi Expression.

JavaScript
t.isExpression(node);

Nodi inclusi:

ExpressionWrapper

Un involucro per espressioni privo di semantica runtime.

JavaScript
t.isExpressionWrapper(node);

Nodi inclusi:

Flow

Raccolta di nodi AST definiti per Flow.

JavaScript
t.isFlow(node);

Nodi inclusi:

FlowBaseAnnotation

Categoria delle annotazioni di tipo primarie in Flow.

JavaScript
t.isFlowBaseAnnotation(node);

Nodi inclusi:

FlowDeclaration

Categoria delle dichiarazioni Flow.

JavaScript
t.isFlowDeclaration(node);

Nodi inclusi:

FlowPredicate

Categoria dei predicati Flow.

JavaScript
t.isFlowPredicate(node);

Nodi inclusi:

FlowType

Categoria delle annotazioni di tipo Flow.

JavaScript
t.isFlowType(node);

Nodi inclusi:

For

Raggruppa le istruzioni ForStatement e ForXStatement.

JavaScript
t.isFor(node);

Nodi inclusi:

ForXStatement

Raggruppa le istruzioni ForIn e ForOf.

JavaScript
t.isForXStatement(node);

Nodi inclusi:

Function

Raggruppa funzioni e metodi, che devono avere body e params. Nota: Function è diverso da FunctionParent. Ad esempio, uno StaticBlock è un FunctionParent ma non una Function.

JavaScript
t.isFunction(node);

Nodi inclusi:

FunctionParameter

Raggruppa i parametri di funzione, che sono elementi della FormalParameterList.

JavaScript
t.isFunctionParameter(node);

Nodi inclusi:

FunctionParent

Un insieme di nodi AST che avviano un contesto di esecuzione con un nuovo VariableEnvironment. In altre parole, definiscono l'ambito delle dichiarazioni var. FunctionParent non includeva Program a partire da Babel 7.

JavaScript
t.isFunctionParent(node);

Nodi inclusi:

Immutabile

Un insieme di oggetti immutabili ed elementi JSX. Un oggetto è considerato immutabile se non è possibile definire altre proprietà dopo la sua creazione.

JavaScript
t.isImmutable(node);

Nodi inclusi:

ImportOrExportDeclaration

History
VersionChanges
v7.21.0Introduced

Un insieme che comprende ImportDeclaration e ExportDeclaration.

JavaScript
t.isImportOrExportDeclaration(node);

Nodi inclusi:

JSX

Un insieme di nodi AST definiti per JSX.

JavaScript
t.isJSX(node);

Nodi inclusi:

LVal

Raggruppa le espressioni del lato sinistro (left-hand side) utilizzate nel membro left delle espressioni di assegnamento e nei cicli ForXStatement.

JavaScript
t.isLVal(node);

Nodi inclusi:

Literal

Raggruppa i Literal, Regular Expression Literal e Template Literal.

JavaScript
t.isLiteral(node);

Nodi inclusi:

Loop

Raggruppa le istruzioni di ciclo.

JavaScript
t.isLoop(node);

Nodi inclusi:

Method

Raggruppa i metodi di oggetto e di classe.

JavaScript
t.isMethod(node);

Nodi inclusi:

Varie

Raggruppa tipi AST non standard utili per lo sviluppo.

JavaScript
t.isMiscellaneous(node);

Nodi inclusi:

ModuleDeclaration

History
VersionChanges
v7.21.0Deprecated
attenzione

Deprecato, utilizza invece ImportOrExportDeclaration. Consulta PR #15266 per le note di migrazione.

JavaScript
t.isModuleDeclaration(node);

Nodi inclusi:

ModuleSpecifier

Copre gli specificatori di importazione ed esportazione. Nota: non è il ModuleSpecifier definito nello standard.

JavaScript
t.isModuleSpecifier(node);

Nodi inclusi:

ObjectMember

Copre i membri in un oggetto letterale.

JavaScript
t.isObjectMember(node);

Nodi inclusi:

Pattern

Copre i BindingPattern eccetto gli Identifiers.

JavaScript
t.isPattern(node);

Nodi inclusi:

PatternLike

Copre i BindingPattern.

JavaScript
t.isPatternLike(node);

Nodi inclusi:

Private

Copre gli elementi privati delle classi e gli identificatori privati.

JavaScript
t.isPrivate(node);

Nodi inclusi:

Property

Copre le proprietà degli oggetti e le proprietà delle classi.

JavaScript
t.isProperty(node);

Nodi inclusi:

Pureish

Una categoria di nodi AST che non producono effetti collaterali. In altre parole, non causano cambiamenti osservabili nel comportamento se valutati più volte.

JavaScript
t.isPureish(node);

Nodi inclusi:

Ambito

Una categoria che include FunctionParent e BlockParent.

JavaScript
t.isScopable(node);

Nodi inclusi:

Standardizzati

Una categoria di nodi AST che fanno parte di una specifica ECMAScript ufficiale.

JavaScript
t.isStandardized(node);

Nodi inclusi:

Istruzione

Include ogni tipo di Statement.

JavaScript
t.isStatement(node);

Nodi inclusi:

TSBaseType

Una categoria delle annotazioni di tipo primarie di TypeScript.

JavaScript
t.isTSBaseType(node);

Nodi inclusi:

TSEntityName

Una categoria delle entità di TypeScript.

JavaScript
t.isTSEntityName(node);

Nodi inclusi:

TSType

Una categoria delle annotazioni di tipo di TypeScript.

JavaScript
t.isTSType(node);

Nodi inclusi:

TSTypeElement

Un insieme di dichiarazioni di tipo TypeScript.

JavaScript
t.isTSTypeElement(node);

Nodi inclusi:

Terminatorless

Un insieme di nodi AST la cui semantica cambia quando viene inserito un terminatore di riga tra l'operatore e l'operando.

JavaScript
t.isTerminatorless(node);

Nodi inclusi:

TypeScript

Un insieme di nodi AST definiti per TypeScript.

JavaScript
t.isTypeScript(node);

Nodi inclusi:

Operatori Unari e Simili

Una categoria che comprende UnaryExpression e SpreadElement.

JavaScript
t.isUnaryLike(node);

Nodi inclusi:

Elementi con Spaziature Utente

Deprecato. Verrà rimosso in Babel 8.

JavaScript
t.isUserWhitespacable(node);

Nodi inclusi:

Cicli While

Una categoria che comprende DoWhileStatement e WhileStatement, che condividono la stessa struttura AST.

JavaScript
t.isWhile(node);

Nodi inclusi: