import { Node } from "https://deno.land/x/fresh@1.6.1/src/dev/deps.ts";
Properties
Gets the underlying compiler node.
Methods
Appends the specified whitespace to current node.
Gets the node as the specified kind if it is equal to that kind, otherwise returns undefined.
Gets the node as the specified kind if it is equal to that kind, otherwise throws.
If the node contains the provided range (inclusive).
Invokes the cbNode
callback for each child and the cbNodeArray
for every array of nodes stored in properties of the node.
If cbNodeArray
is not defined, then it will pass every element of the array to cbNode
.
Gets the child nodes passed to the delegate of node.forEachChild(child => {})
as an array.
Invokes the cbNode
callback for each descendant and the cbNodeArray
for every array of nodes stored in properties of the node and descendant nodes.
If cbNodeArray
is not defined, then it will pass every element of the array to cbNode
.
Gets the descendant nodes passed to the delegate of node.forEachDescendant(descendant => {})
as an array.
Releases the node and all its descendants from the underlying node cache and ast.
This is useful if you want to improve the performance of manipulation by not tracking this node anymore.
Forgets the descendants of this node.
Formats the node's text using the internal TypeScript formatting API.
Goes up the tree getting all the parents in ascending order.
Gets the child at the specified index.
Gets the child at the specified index if it's the specified kind or returns undefined.
Gets the child at the specified index if it's the specified kind or throws an exception.
Gets the child at the provided text position, or undefined if not found.
Gets the number of children the node has.
Gets the child indentation level of the current node.
Gets the next indentation level text.
Gets the child index of this node relative to the parent.
Gets all the children of the node.
Gets the children based on a kind.
Gets the child syntax list if it exists.
Gets the child syntax list or throws if it doesn't exist.
Gets the combined modifier flags.
Gets the most specific descendant at the provided text position, or undefined if not found.
Gets the most specific descendant at the provided start text position with the specified width, or undefined if not found.
Gets the node's descendants.
Gets the descendants that match a specified syntax kind.
Gets the node's descendant statements and any arrow function statement-like expressions (ex. returns the expression 5
in () => 5
).
Gets the source file text position where the node ends.
Gets the line number of the end of the node.
Gets the first ancestor that matches the provided condition or returns undefined if not found.
Gets the first ancestor that matches the provided condition or returns undefined if not found.
Get the first ancestor by syntax kind.
Gets the first ancestor by syntax kind or throws if not found.
Gets the first ancestor that matches the provided condition or throws if not found.
Gets the first ancestor that matches the provided condition or throws if not found.
Gets the first child by a condition.
Gets the first child by a condition.
Gets the first child by syntax kind.
Gets the first child by syntax kind or throws an error if not found.
Gets the first child if it matches the specified syntax kind.
Gets the first child if it matches the specified syntax kind or throws an error if not found.
Gets the first child by a condition or throws.
Gets the first child by a condition or throws.
Gets the first descendant by a condition.
Gets the first descendant by a condition.
Gets the first descendant by syntax kind.
Gets the first descendant by syntax kind or throws.
Gets the first descendant by a condition or throws.
Gets the first descendant by a condition or throws.
Gets the node's flags.
Gets the source file text position of the end of the last significant token or the start of the source file.
Gets the full text with leading trivia (comments and whitespace).
Gets the text length of the node with trivia.
Gets the indentation level of the current node.
Gets the indentation text.
Gets the syntax kind.
Gets the syntax kind name.
Gets the last child by a condition.
Gets the last child by a condition.
Gets the last child by syntax kind.
Gets the last child by syntax kind or throws an error if not found.
Gets the last child if it matches the specified syntax kind.
Gets the last child if it matches the specified syntax kind or throws an error if not found.
Gets the last child by a condition or throws.
Gets the last child by a condition or throws.
Gets the last token of this node. Usually this is a close brace.
Gets the leading comment ranges of the current node.
Gets the node's leading trivia's text length.
Gets the specified local symbol by name or returns undefined if it doesn't exist.
WARNING: The symbol table of locals is not exposed publicly by the compiler. Use this at your own risk knowing it may break.
Gets the specified local symbol by name or throws if it doesn't exist.
WARNING: The symbol table of locals is not exposed publicly by the compiler. Use this at your own risk knowing it may break.
Gets the symbols within the current scope.
WARNING: The symbol table of locals is not exposed publicly by the compiler. Use this at your own risk knowing it may break.
Gets the next sibling.
Gets the next sibling.
Gets the next sibling if it matches the specified kind.
Gets the next sibiling if it matches the specified kind, or throws.
Gets the next sibling or throws.
Gets the next sibling or throws.
Gets the next siblings.
Note: Closest sibling is the zero index.
Gets a compiler node property wrapped in a Node.
Gets the first source file text position that is not whitespace taking into account comment nodes and a previous node's trailing trivia.
Gets the parent if it matches a certain condition.
Gets the parent if it matches a certain condition.
Gets the parent if it's a certain syntax kind.
Gets the parent if it's a certain syntax kind or throws.
Gets the parent if it matches a certain condition or throws.
Gets the parent if it matches a certain condition or throws.
Gets the parent or throws an error if it doesn't exist.
Gets the parent if it's a syntax list.
Gets the parent if it's a syntax list or throws an error otherwise.
Goes up the parents (ancestors) of the node while a condition is true. Returns undefined if the initial parent doesn't match the condition.
Goes up the parents (ancestors) of the node while a condition is true. Returns undefined if the initial parent doesn't match the condition.
Goes up the parents (ancestors) of the node while the parent is the specified syntax kind. Returns undefined if the initial parent is not the specified syntax kind.
Goes up the parents (ancestors) of the node while the parent is the specified syntax kind. Throws if the initial parent is not the specified syntax kind.
Goes up the parents (ancestors) of the node while a condition is true. Throws if the initial parent doesn't match the condition.
Goes up the parents (ancestors) of the node while a condition is true. Throws if the initial parent doesn't match the condition.
Gets the source file text position where the node starts that includes the leading trivia (comments and whitespace).
Gets the previous sibling.
Gets the previous sibling.
Gets the previous sibling if it matches the specified kind.
Gets the previous sibiling if it matches the specified kind, or throws.
Gets the previous sibling or throws.
Gets the previous sibling or throws.
Gets the previous siblings.
Note: Closest sibling is the zero index.
Gets the project.
Gets the source file.
Gets the source file text position where the node starts that does not include the leading trivia (comments and whitespace).
Gets the line number at the start of the node.
Gets the position of the start of the line that this node starts on.
Gets the compiler symbol or undefined if it doesn't exist.
Gets the symbol or throws an error if it doesn't exist.
Gets the symbols in the scope of the node.
Note: This will always return the local symbols. If you want the export symbol from a local symbol, then
use the #getExportSymbol()
method on the symbol.
Gets the text without leading trivia (comments and whitespace).
Gets the text without leading trivia (comments and whitespace).
Gets the trailing comment ranges of the current node.
Gets the text position of the next significant token or new line.
Gets the text length from the end of the current node to the next significant token or new line.
Gets the type of the node.
Gets the text length of the node without trivia.
Gets if this is the first node on the current line.
Gets if the specified position is within a string.
Gets if this node is in a syntax list.
Returns if the node is the specified kind.
This is a type guard.
Prepends the specified whitespace to current node.
Prints the node using the compiler's printer.
Replaces the text of the current node with new text.
This will forget the current node and return a new node that can be asserted or type guarded to the correct type.
Transforms the node using the compiler api nodes and functions and returns the node that was transformed (experimental).
WARNING: This will forget descendants of transformed nodes and potentially this node.
Gets if the compiler node was forgotten.
This will be true when the compiler node was forgotten or removed.
Static Properties
Gets if the node is an AnyKeyword.
Gets if the node is an ArrayBindingPattern.
Gets if the node is an ArrayLiteralExpression.
Gets if the node is an ArrowFunction.
Gets if the node is an AsExpression.
Gets if the node is an AssertClause.
Gets if the node is an AssertEntry.
Gets if the node is an AwaitExpression.
Gets if the node is a BigIntLiteral.
Gets if the node is a BinaryExpression.
Gets if the node is a BindingElement.
Gets if the node is a Block.
Gets if the node is a BooleanKeyword.
Gets if the node is a BreakStatement.
Gets if the node is a CallExpression.
Gets if the node is a CaseBlock.
Gets if the node is a CaseClause.
Gets if the node is a CatchClause.
Gets if the node is a ClassDeclaration.
Gets if the node is a ClassExpression.
Gets if the node is a ClassStaticBlockDeclaration.
Gets if the node is a CommaListExpression.
Gets if the node is a ComputedPropertyName.
Gets if the node is a ConditionalExpression.
Gets if the node is a ContinueStatement.
Gets if the node is a DebuggerStatement.
Gets if the node is a Decorator.
Gets if the node is a DefaultClause.
Gets if the node is a DeleteExpression.
Gets if the node is a DoStatement.
Gets if the node is an ElementAccessExpression.
Gets if the node is an EmptyStatement.
Gets if the node is an EnumDeclaration.
Gets if the node is an EnumMember.
Gets if the node is an ExportAssignment.
Gets if the node is an ExportDeclaration.
Gets if the node is an ExportSpecifier.
Gets if the node is an ExpressionStatement.
Gets if the node is an ExpressionWithTypeArguments.
Gets if the node is an ExternalModuleReference.
Gets if the node is a ForInStatement.
Gets if the node is a ForOfStatement.
Gets if the node is a ForStatement.
Gets if the node is a FunctionDeclaration.
Gets if the node is a FunctionExpression.
Gets if the node is a HeritageClause.
Gets if the node is a Identifier.
Gets if the node is a IfStatement.
Gets if the node is a ImportClause.
Gets if the node is a ImportDeclaration.
Gets if the node is a ImportEqualsDeclaration.
Gets if the node is a ImportSpecifier.
Gets if the node is a ImportTypeAssertionContainer.
Gets if the node is a InferKeyword.
Gets if the node is a InterfaceDeclaration.
Gets if the node is a JSDoc.
Gets if the node is a JSDocAllType.
Gets if the node is a JSDocAugmentsTag.
Gets if the node is a JSDocAuthorTag.
Gets if the node is a JSDocCallbackTag.
Gets if the node is a JSDocClassTag.
Gets if the node is a JSDocDeprecatedTag.
Gets if the node is a JSDocEnumTag.
Gets if the node is a JSDocFunctionType.
Gets if the node is a JSDocImplementsTag.
Gets if the node is a JSDocLink.
Gets if the node is a JSDocLinkCode.
Gets if the node is a JSDocLinkPlain.
Gets if the node is a JSDocMemberName.
Gets if the node is a JSDocNamepathType.
Gets if the node is a JSDocNameReference.
Gets if the node is a JSDocNonNullableType.
Gets if the node is a JSDocNullableType.
Gets if the node is a JSDocOptionalType.
Gets if the node is a JSDocOverloadTag.
Gets if the node is a JSDocOverrideTag.
Gets if the node is a JSDocParameterTag.
Gets if the node is a JSDocPrivateTag.
Gets if the node is a JSDocPropertyTag.
Gets if the node is a JSDocProtectedTag.
Gets if the node is a JSDocPublicTag.
Gets if the node is a JSDocReadonlyTag.
Gets if the node is a JSDocReturnTag.
Gets if the node is a JSDocSatisfiesTag.
Gets if the node is a JSDocSeeTag.
Gets if the node is a JSDocSignature.
Gets if the node is a JSDocTemplateTag.
Gets if the node is a JSDocText.
Gets if the node is a JSDocThisTag.
Gets if the node is a JSDocThrowsTag.
Gets if the node is a JSDocTypedefTag.
Gets if the node is a JSDocTypeExpression.
Gets if the node is a JSDocTypeLiteral.
Gets if the node is a JSDocTypeTag.
Gets if the node is a JSDocUnknownType.
Gets if the node is a JSDocVariadicType.
Gets if the node is a JsxAttribute.
Gets if the node is a JsxClosingElement.
Gets if the node is a JsxClosingFragment.
Gets if the node is a JsxElement.
Gets if the node is a JsxExpression.
Gets if the node is a JsxFragment.
Gets if the node is a JsxNamespacedName.
Gets if the node is a JsxOpeningElement.
Gets if the node is a JsxOpeningFragment.
Gets if the node is a JsxSelfClosingElement.
Gets if the node is a JsxSpreadAttribute.
Gets if the node is a JsxText.
Gets if the node is a LabeledStatement.
Gets if the node is a MetaProperty.
Gets if the node is a MethodDeclaration.
Gets if the node is a MethodSignature.
Gets if the node is a ModuleBlock.
Gets if the node is a ModuleDeclaration.
Gets if the node is a NamedExports.
Gets if the node is a NamedImports.
Gets if the node is a NamedTupleMember.
Gets if the node is a NamespaceExport.
Gets if the node is a NamespaceImport.
Gets if the node is a NeverKeyword.
Gets if the node is a NewExpression.
Gets if the node is a NonNullExpression.
Gets if the node is a NoSubstitutionTemplateLiteral.
Gets if the node is a NotEmittedStatement.
Gets if the node is a NumberKeyword.
Gets if the node is a NumericLiteral.
Gets if the node is a ObjectBindingPattern.
Gets if the node is a ObjectKeyword.
Gets if the node is a ObjectLiteralExpression.
Gets if the node is a OmittedExpression.
Gets if the node is a ParenthesizedExpression.
Gets if the node is a PartiallyEmittedExpression.
Gets if the node is a PostfixUnaryExpression.
Gets if the node is a PrefixUnaryExpression.
Gets if the node is a PrivateIdentifier.
Gets if the node is a PropertyAccessExpression.
Gets if the node is a PropertyAssignment.
Gets if the node is a PropertyDeclaration.
Gets if the node is a PropertySignature.
Gets if the node is a QualifiedName.
Gets if the node is a RegularExpressionLiteral.
Gets if the node is a ReturnStatement.
Gets if the node is a SatisfiesExpression.
Gets if the node is a SemicolonToken.
Gets if the node is a ShorthandPropertyAssignment.
Gets if the node is a SourceFile.
Gets if the node is a SpreadAssignment.
Gets if the node is a SpreadElement.
Gets if the node is a StringKeyword.
Gets if the node is a StringLiteral.
Gets if the node is a SwitchStatement.
Gets if the node is a SymbolKeyword.
Gets if the node is a SyntaxList.
Gets if the node is a TaggedTemplateExpression.
Gets if the node is a TemplateExpression.
Gets if the node is a TemplateHead.
Gets if the node is a TemplateMiddle.
Gets if the node is a TemplateSpan.
Gets if the node is a TemplateTail.
Gets if the node is a ThrowStatement.
Gets if the node is a TryStatement.
Gets if the node is a TypeAliasDeclaration.
Gets if the node is a TypeOfExpression.
Gets if the node is a UndefinedKeyword.
Gets if the node is a VariableDeclaration.
Gets if the node is a VariableDeclarationList.
Gets if the node is a VariableStatement.
Gets if the node is a VoidExpression.
Gets if the node is a WhileStatement.
Gets if the node is a WithStatement.
Gets if the node is a YieldExpression.
Static Methods
Gets if the node has an expression.
Gets if the node has a name.
Gets if the node has a structure.
Creates a type guard for syntax kinds.
Gets if the node is an AbstractableNode.
Gets if the node is an AmbientableNode.
Gets if the node is an ArgumentedNode.
Gets if the node is an ArrayTypeNode.
Gets if the node is an AssertionKeyNamedNode.
Gets if the node is an AsyncableNode.
Gets if the node is an AwaitableNode.
Gets if the node is a BindingNamedNode.
Gets if the node is a BodiedNode.
Gets if the node is a BodyableNode.
Gets if the node is a CallSignatureDeclaration.
Gets if the node is a ChildOrderableNode.
Gets if the node is a ClassLikeDeclarationBase.
Gets if the provided node is a CommentClassElement.
Gets if the provided node is a CommentEnumMember.
Gets if the provided node is a comment node.
Gets if the provided node is a CommentObjectLiteralElement.
Gets if the provided node is a CommentStatement.
Gets if the provided value is a CommentTypeElement.
Gets if the node is a ConditionalTypeNode.
Gets if the node is a ConstructorDeclaration.
Gets if the node is a ConstructorTypeNode.
Gets if the node is a ConstructSignatureDeclaration.
Gets if the node is a DecoratableNode.
Gets if the node is a DotDotDotTokenableNode.
Gets if the node is an ExclamationTokenableNode.
Gets if the node is an ExportableNode.
Gets if the node is an ExportGetableNode.
Gets if the node is an Expression.
Gets if the node is an ExpressionableNode.
Gets if the node is an ExpressionedNode.
Gets if the node is an ExtendsClauseableNode.
Gets if the node is a FalseLiteral.
Gets if the node is a FunctionLikeDeclaration.
Gets if the node is a FunctionTypeNode.
Gets if the node is a GeneratorableNode.
Gets if the node is a GetAccessorDeclaration.
Gets if the node is a HeritageClauseableNode.
Gets if the node is a ImplementsClauseableNode.
Gets if the node is a ImportExpression.
Gets if the node is a ImportTypeNode.
Gets if the node is a IndexedAccessTypeNode.
Gets if the node is a IndexSignatureDeclaration.
Gets if the node is a InferTypeNode.
Gets if the node is a InitializerExpressionableNode.
Gets if the node is a InitializerExpressionGetableNode.
Gets if the node is a IntersectionTypeNode.
Gets if the node is a IterationStatement.
Gets if the node is a JSDocableNode.
Gets if the node is a JSDocPropertyLikeTag.
Gets if the node is a JSDocTag.
Gets if the node is a JSDocType.
Gets if the node is a JSDocTypeExpressionableTag.
Gets if the node is a JSDocTypeParameteredTag.
Gets if the node is a JSDocUnknownTag.
Gets if the node is a JsxAttributedNode.
Gets if the node is a JsxTagNamedNode.
Gets if the node is a LeftHandSideExpression.
Gets if the node is a LeftHandSideExpressionedNode.
Gets if the node is a LiteralExpression.
Gets if the node is a LiteralLikeNode.
Gets if the node is a LiteralTypeNode.
Gets if the node is a MappedTypeNode.
Gets if the node is a MemberExpression.
Gets if the node is a ModifierableNode.
Gets if the node is a ModuleChildableNode.
Gets if the node is a ModuledNode.
Gets if the node is a ModuleNamedNode.
Gets if the node is a NameableNode.
Gets if the node is a NamedNode.
Gets if the node is a NodeWithTypeArguments.
Gets if the node is a NullLiteral.
Gets if the node is a OverloadableNode.
Gets if the node is a OverrideableNode.
Gets if the node is a ParameterDeclaration.
Gets if the node is a ParameteredNode.
Gets if the node is a ParenthesizedTypeNode.
Gets if the node is a PrimaryExpression.
Gets if the node is a PropertyNamedNode.
Gets if the node is a QuestionDotTokenableNode.
Gets if the node is a QuestionTokenableNode.
Gets if the node is a ReadonlyableNode.
Gets if the node is a ReferenceFindableNode.
Gets if the node is a RenameableNode.
Gets if the node is a RestTypeNode.
Gets if the node is a ReturnTypedNode.
Gets if the node is a ScopeableNode.
Gets if the node is a ScopedNode.
Gets if the node is a SetAccessorDeclaration.
Gets if the node is a SignaturedDeclaration.
Gets if the node is a Statement.
Gets if the node is a StatementedNode.
Gets if the node is a StaticableNode.
Gets if the node is a SuperExpression.
Gets if the node is a TemplateLiteralTypeNode.
Gets if the node is a TextInsertableNode.
Gets if the node is a ThisExpression.
Gets if the node is a ThisTypeNode.
Gets if the node is a TrueLiteral.
Gets if the node is a TupleTypeNode.
Gets if the node is a TypeArgumentedNode.
Gets if the node is a TypeAssertion.
Gets if the node is a TypedNode.
Gets if the node is a TypeElement.
Gets if the node is a TypeElementMemberedNode.
Gets if the node is a TypeLiteralNode.
Gets if the node is a TypeNode.
Gets if the node is a TypeOperatorTypeNode.
Gets if the node is a TypeParameterDeclaration.
Gets if the node is a TypeParameteredNode.
Gets if the node is a TypePredicateNode.
Gets if the node is a TypeQueryNode.
Gets if the node is a TypeReferenceNode.
Gets if the node is a UnaryExpression.
Gets if the node is a UnaryExpressionedNode.
Gets if the node is a UnionTypeNode.
Gets if the node is a UnwrappableNode.
Gets if the node is a UpdateExpression.