@servicenow/sdk - v4.4.1
    Preparing search index...
    interface InstanceofExpression {
        compilerNode: tsc.InstanceofExpression;
        appendWhitespace(textOrWriterFunction: string | WriterFunction): void;
        asKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        asKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        containsRange(pos: number, end: number): boolean;
        forEachChild<T>(
            cbNode: (node: Node) => T | undefined,
            cbNodeArray?: (nodes: Node<tsc.Node>[]) => T | undefined,
        ): T | undefined;
        forEachChildAsArray(): Node<tsc.Node>[];
        forEachDescendant<T>(
            cbNode: (
                node: Node,
                traversal: ForEachDescendantTraversalControl,
            ) => T | undefined,
            cbNodeArray?: (
                nodes: Node<tsc.Node>[],
                traversal: ForEachDescendantTraversalControl,
            ) => T | undefined,
        ): T | undefined;
        forEachDescendantAsArray(): Node<tsc.Node>[];
        forget(): void;
        forgetDescendants(): void;
        formatText(settings?: FormatCodeSettings): void;
        getAncestors(): Node<tsc.Node>[];
        getChildAtIndex(index: number): Node;
        getChildAtIndexIfKind<TKind extends tsc.SyntaxKind>(
            index: number,
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getChildAtIndexIfKindOrThrow<TKind extends tsc.SyntaxKind>(
            index: number,
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getChildAtPos(pos: number): Node<tsc.Node> | undefined;
        getChildCount(): number;
        getChildIndentationLevel(): number;
        getChildIndentationText(offset?: number): string;
        getChildIndex(): number;
        getChildren(): Node<tsc.Node>[];
        getChildrenOfKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind][];
        getChildSyntaxList(): SyntaxList | undefined;
        getChildSyntaxListOrThrow(message?: string | (() => string)): SyntaxList;
        getCombinedModifierFlags(): ModifierFlags;
        getContextualType(): Type<tsc.Type> | undefined;
        getDescendantAtPos(pos: number): Node<tsc.Node> | undefined;
        getDescendantAtStartWithWidth(
            start: number,
            width: number,
        ): Node<tsc.Node> | undefined;
        getDescendants(): Node<tsc.Node>[];
        getDescendantsOfKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind][];
        getDescendantStatements(): (
            Statement<tsc.Statement>
            | Expression<tsc.Expression>
        )[];
        getEnd(): number;
        getEndLineNumber(): number;
        getFirstAncestor<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
        ): T | undefined;
        getFirstAncestor(
            condition?: (node: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getFirstAncestorByKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getFirstAncestorByKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getFirstAncestorOrThrow<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
        ): T;
        getFirstAncestorOrThrow(condition?: (node: Node) => boolean): Node;
        getFirstChild<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
        ): T | undefined;
        getFirstChild(
            condition?: (node: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getFirstChildByKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getFirstChildByKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getFirstChildIfKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getFirstChildIfKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getFirstChildOrThrow<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
            message?: string | (() => string),
        ): T;
        getFirstChildOrThrow(
            condition?: (node: Node) => boolean,
            message?: string | (() => string),
        ): Node;
        getFirstDescendant<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
        ): T | undefined;
        getFirstDescendant(
            condition?: (node: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getFirstDescendantByKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getFirstDescendantByKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getFirstDescendantOrThrow<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
            message?: string | (() => string),
        ): T;
        getFirstDescendantOrThrow(
            condition?: (node: Node) => boolean,
            message?: string | (() => string),
        ): Node;
        getFlags(): tsc.NodeFlags;
        getFullStart(): number;
        getFullText(): string;
        getFullWidth(): number;
        getIndentationLevel(): number;
        getIndentationText(offset?: number): string;
        getKind(): tsc.SyntaxKind;
        getKindName(): string;
        getLastChild<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
        ): T | undefined;
        getLastChild(
            condition?: (node: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getLastChildByKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getLastChildByKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getLastChildIfKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getLastChildIfKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getLastChildOrThrow<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
            message?: string | (() => string),
        ): T;
        getLastChildOrThrow(
            condition?: (node: Node) => boolean,
            message?: string | (() => string),
        ): Node;
        getLastToken(): Node;
        getLeadingCommentRanges(): CommentRange[];
        getLeadingTriviaWidth(): number;
        getLeft(): Expression;
        getLocal(name: string): Symbol | undefined;
        getLocalOrThrow(name: string, message?: string | (() => string)): Symbol;
        getLocals(): Symbol[];
        getNextSibling<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
        ): T | undefined;
        getNextSibling(
            condition?: (node: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getNextSiblingIfKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getNextSiblingIfKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getNextSiblingOrThrow<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
            message?: string | (() => string),
        ): T;
        getNextSiblingOrThrow(
            condition?: (node: Node) => boolean,
            message?: string | (() => string),
        ): Node;
        getNextSiblings(): Node<tsc.Node>[];
        getNodeProperty<
            KeyType extends string
            | number
            | symbol,
            LocalNodeType extends tsc.Node = tsc.BinaryExpression,
        >(
            propertyName: KeyType,
        ): NodePropertyToWrappedType<LocalNodeType, KeyType>;
        getNonWhitespaceStart(): number;
        getOperatorToken(): Node<Token<InstanceOfKeyword>>;
        getParent(): Node<tsc.Node> | undefined;
        getParentIf<T extends Node<tsc.Node>>(
            condition: (
                parent: Node<tsc.Node> | undefined,
                node: Node,
            ) => parent is T,
        ): T | undefined;
        getParentIf(
            condition: (parent: Node<tsc.Node> | undefined, node: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getParentIfKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getParentIfKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getParentIfOrThrow<T extends Node<tsc.Node>>(
            condition: (
                parent: Node<tsc.Node> | undefined,
                node: Node,
            ) => parent is T,
            message?: string | (() => string),
        ): T;
        getParentIfOrThrow(
            condition: (parent: Node<tsc.Node> | undefined, node: Node) => boolean,
            message?: string | (() => string),
        ): Node;
        getParentOrThrow(message?: string | (() => string)): Node<tsc.Node>;
        getParentSyntaxList(): SyntaxList | undefined;
        getParentSyntaxListOrThrow(message?: string | (() => string)): SyntaxList;
        getParentWhile<T extends Node<tsc.Node>>(
            condition: (parent: Node, child: Node) => parent is T,
        ): T | undefined;
        getParentWhile(
            condition: (parent: Node, child: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getParentWhileKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getParentWhileKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getParentWhileOrThrow<T extends Node<tsc.Node>>(
            condition: (parent: Node, node: Node) => parent is T,
            message?: string | (() => string),
        ): T;
        getParentWhileOrThrow(
            condition: (parent: Node, node: Node) => boolean,
            message?: string | (() => string),
        ): Node;
        getPos(): number;
        getPreviousSibling<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
        ): T | undefined;
        getPreviousSibling(
            condition?: (node: Node) => boolean,
        ): Node<tsc.Node> | undefined;
        getPreviousSiblingIfKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): KindToNodeMappings[TKind] | undefined;
        getPreviousSiblingIfKindOrThrow<TKind extends tsc.SyntaxKind>(
            kind: TKind,
            message?: string | (() => string),
        ): KindToNodeMappings[TKind];
        getPreviousSiblingOrThrow<T extends Node<tsc.Node>>(
            condition?: (node: Node) => node is T,
            message?: string | (() => string),
        ): T;
        getPreviousSiblingOrThrow(
            condition?: (node: Node) => boolean,
            message?: string | (() => string),
        ): Node;
        getPreviousSiblings(): Node<tsc.Node>[];
        getProject(): Project;
        getRight(): Expression;
        getSourceFile(): SourceFile;
        getStart(includeJsDocComments?: boolean): number;
        getStartLineNumber(includeJsDocComments?: boolean): number;
        getStartLinePos(includeJsDocComments?: boolean): number;
        getSymbol(): Symbol | undefined;
        getSymbolOrThrow(message?: string | (() => string)): Symbol;
        getSymbolsInScope(meaning: tsc.SymbolFlags): Symbol[];
        getText(includeJsDocComments?: boolean): string;
        getText(
            options: {
                includeJsDocComments?: boolean;
                trimLeadingIndentation?: boolean;
            },
        ): string;
        getTrailingCommentRanges(): CommentRange[];
        getTrailingTriviaEnd(): number;
        getTrailingTriviaWidth(): number;
        getType(): Type;
        getWidth(includeJsDocComments?: boolean): number;
        isFirstNodeOnLine(): boolean;
        isInStringAtPos(pos: number): boolean;
        isInSyntaxList(): boolean;
        isKind<TKind extends tsc.SyntaxKind>(
            kind: TKind,
        ): this is KindToNodeMappings[TKind];
        prependWhitespace(textOrWriterFunction: string | WriterFunction): void;
        print(options?: PrintNodeOptions): string;
        replaceWithText(textOrWriterFunction: string | WriterFunction): Node;
        transform(
            visitNode: (traversal: TransformTraversalControl) => tsc.Node,
        ): Node;
        wasForgotten(): boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Methods

    appendWhitespace asKind asKindOrThrow containsRange forEachChild forEachChildAsArray forEachDescendant forEachDescendantAsArray forget forgetDescendants formatText getAncestors getChildAtIndex getChildAtIndexIfKind getChildAtIndexIfKindOrThrow getChildAtPos getChildCount getChildIndentationLevel getChildIndentationText getChildIndex getChildren getChildrenOfKind getChildSyntaxList getChildSyntaxListOrThrow getCombinedModifierFlags getContextualType getDescendantAtPos getDescendantAtStartWithWidth getDescendants getDescendantsOfKind getDescendantStatements getEnd getEndLineNumber getFirstAncestor getFirstAncestorByKind getFirstAncestorByKindOrThrow getFirstAncestorOrThrow getFirstChild getFirstChildByKind getFirstChildByKindOrThrow getFirstChildIfKind getFirstChildIfKindOrThrow getFirstChildOrThrow getFirstDescendant getFirstDescendantByKind getFirstDescendantByKindOrThrow getFirstDescendantOrThrow getFlags getFullStart getFullText getFullWidth getIndentationLevel getIndentationText getKind getKindName getLastChild getLastChildByKind getLastChildByKindOrThrow getLastChildIfKind getLastChildIfKindOrThrow getLastChildOrThrow getLastToken getLeadingCommentRanges getLeadingTriviaWidth getLeft getLocal getLocalOrThrow getLocals getNextSibling getNextSiblingIfKind getNextSiblingIfKindOrThrow getNextSiblingOrThrow getNextSiblings getNodeProperty getNonWhitespaceStart getOperatorToken getParent getParentIf getParentIfKind getParentIfKindOrThrow getParentIfOrThrow getParentOrThrow getParentSyntaxList getParentSyntaxListOrThrow getParentWhile getParentWhileKind getParentWhileKindOrThrow getParentWhileOrThrow getPos getPreviousSibling getPreviousSiblingIfKind getPreviousSiblingIfKindOrThrow getPreviousSiblingOrThrow getPreviousSiblings getProject getRight getSourceFile getStart getStartLineNumber getStartLinePos getSymbol getSymbolOrThrow getSymbolsInScope getText getTrailingCommentRanges getTrailingTriviaEnd getTrailingTriviaWidth getType getWidth isFirstNodeOnLine isInStringAtPos isInSyntaxList isKind prependWhitespace print replaceWithText transform wasForgotten

    Properties

    Gets the underlying compiler node.

    Methods

    • Appends the specified whitespace to current node.

      Parameters

      • textOrWriterFunction: string | WriterFunction

        Text or writer function.

      Returns void

    • If the node contains the provided range (inclusive).

      Parameters

      • pos: number

        Start position.

      • end: number

        End position.

      Returns boolean

    • 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.

      Type Parameters

      • T

      Parameters

      • cbNode: (node: Node) => T | undefined

        Callback invoked for each child.

      • OptionalcbNodeArray: (nodes: Node<tsc.Node>[]) => T | undefined

        Callback invoked for each array of nodes.

      Returns T | undefined

      The first truthy value returned by a callback.

    • Gets the child nodes passed to the delegate of node.forEachChild(child => {}) as an array.

      Returns Node<tsc.Node>[]

    • 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.

      Type Parameters

      • T

      Parameters

      Returns T | undefined

      The first truthy value returned by a callback.

      There exists a traversal object on the second parameter that allows various control of iteration.

    • Gets the descendant nodes passed to the delegate of node.forEachDescendant(descendant => {}) as an array.

      Returns Node<tsc.Node>[]

    • 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.

      Returns void

    • Forgets the descendants of this node.

      Returns void

    • Formats the node's text using the internal TypeScript formatting API.

      Parameters

      Returns void

    • Goes up the tree getting all the parents in ascending order.

      Returns Node<tsc.Node>[]

    • Gets the child at the specified index.

      Parameters

      • index: number

        Index of the child.

      Returns Node

    • Gets the child at the provided text position, or undefined if not found.

      Parameters

      • pos: number

        Text position to search for.

      Returns Node<tsc.Node> | undefined

    • Gets the number of children the node has.

      Returns number

    • Gets the child indentation level of the current node.

      Returns number

    • Gets the next indentation level text.

      Parameters

      • Optionaloffset: number

        Optional number of levels of indentation to add or remove.

      Returns string

    • Gets the child index of this node relative to the parent.

      Returns number

    • Gets the child syntax list or throws if it doesn't exist.

      Parameters

      • Optionalmessage: string | (() => string)

      Returns SyntaxList

    • Gets the most specific descendant at the provided text position, or undefined if not found.

      Parameters

      • pos: number

        Text position to search for.

      Returns Node<tsc.Node> | undefined

    • Gets the most specific descendant at the provided start text position with the specified width, or undefined if not found.

      Parameters

      • start: number

        Start text position to search for.

      • width: number

        Text length of the node to search for.

      Returns Node<tsc.Node> | undefined

    • Gets the source file text position where the node ends.

      Returns number

      This does not include the following trivia (comments and whitespace).

    • Gets the line number of the end of the node.

      Returns number

    • Gets the first ancestor that matches the provided condition or returns undefined if not found.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition to match.

      Returns T | undefined

    • Gets the first ancestor that matches the provided condition or returns undefined if not found.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition to match.

      Returns Node<tsc.Node> | undefined

    • Gets the first ancestor that matches the provided condition or throws if not found.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition to match.

      Returns T

    • Gets the first ancestor that matches the provided condition or throws if not found.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition to match.

      Returns Node

    • Gets the first child by a condition.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition.

      Returns T | undefined

    • Gets the first child by a condition.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition.

      Returns Node<tsc.Node> | undefined

    • Gets the first child by a condition or throws.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition.

      • Optionalmessage: string | (() => string)

      Returns T

    • Gets the first child by a condition or throws.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition.

      • Optionalmessage: string | (() => string)

      Returns Node

    • Gets the first descendant by a condition.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition.

      Returns T | undefined

    • Gets the first descendant by a condition.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition.

      Returns Node<tsc.Node> | undefined

    • Gets the first descendant by a condition or throws.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition.

      • Optionalmessage: string | (() => string)

      Returns T

    • Gets the first descendant by a condition or throws.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition.

      • Optionalmessage: string | (() => string)

      Returns Node

    • Gets the source file text position of the end of the last significant token or the start of the source file.

      Returns number

    • Gets the full text with leading trivia (comments and whitespace).

      Returns string

    • Gets the text length of the node with trivia.

      Returns number

    • Gets the indentation level of the current node.

      Returns number

    • Gets the indentation text.

      Parameters

      • Optionaloffset: number

        Optional number of levels of indentation to add or remove.

      Returns string

    • Gets the syntax kind name.

      Returns string

    • Gets the last child by a condition.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition.

      Returns T | undefined

    • Gets the last child by a condition.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition.

      Returns Node<tsc.Node> | undefined

    • Gets the last child by a condition or throws.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Condition.

      • Optionalmessage: string | (() => string)

      Returns T

    • Gets the last child by a condition or throws.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Condition.

      • Optionalmessage: string | (() => string)

      Returns Node

    • Gets the last token of this node. Usually this is a close brace.

      Returns Node

    • Gets the node's leading trivia's text length.

      Returns number

    • 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.

      Parameters

      • name: string

        Name of the local symbol.

      Returns Symbol | undefined

    • 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.

      Parameters

      • name: string

        Name of the local symbol.

      • Optionalmessage: string | (() => string)

      Returns Symbol

    • 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.

      Returns Symbol[]

    • Gets the next sibling.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Optional condition for getting the next sibling.

      Returns T | undefined

    • Gets the next sibling.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Optional condition for getting the next sibling.

      Returns Node<tsc.Node> | undefined

    • Gets the next sibling or throws.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Optional condition for getting the next sibling.

      • Optionalmessage: string | (() => string)

      Returns T

    • Gets the next sibling or throws.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Optional condition for getting the next sibling.

      • Optionalmessage: string | (() => string)

      Returns Node

    • Gets the first source file text position that is not whitespace taking into account comment nodes and a previous node's trailing trivia.

      Returns number

    • Gets the parent if it matches a certain condition.

      Type Parameters

      Parameters

      Returns T | undefined

    • Gets the parent if it matches a certain condition.

      Parameters

      Returns Node<tsc.Node> | undefined

    • Gets the parent if it matches a certain condition or throws.

      Type Parameters

      Parameters

      • condition: (parent: Node<tsc.Node> | undefined, node: Node) => parent is T
      • Optionalmessage: string | (() => string)

      Returns T

    • Gets the parent if it matches a certain condition or throws.

      Parameters

      • condition: (parent: Node<tsc.Node> | undefined, node: Node) => boolean
      • Optionalmessage: string | (() => string)

      Returns Node

    • Gets the parent or throws an error if it doesn't exist.

      Parameters

      • Optionalmessage: string | (() => string)

      Returns Node<tsc.Node>

    • Gets the parent if it's a syntax list or throws an error otherwise.

      Parameters

      • Optionalmessage: string | (() => string)

      Returns SyntaxList

    • Goes up the parents (ancestors) of the node while a condition is true. Returns undefined if the initial parent doesn't match the condition.

      Type Parameters

      Parameters

      • condition: (parent: Node, child: Node) => parent is T

        Condition that tests the parent to see if the expression is true.

      Returns T | undefined

    • Goes up the parents (ancestors) of the node while a condition is true. Returns undefined if the initial parent doesn't match the condition.

      Parameters

      • condition: (parent: Node, child: Node) => boolean

        Condition that tests the parent to see if the expression is true.

      Returns Node<tsc.Node> | undefined

    • Goes up the parents (ancestors) of the node while a condition is true. Throws if the initial parent doesn't match the condition.

      Type Parameters

      Parameters

      • condition: (parent: Node, node: Node) => parent is T

        Condition that tests the parent to see if the expression is true.

      • Optionalmessage: string | (() => string)

      Returns T

    • Goes up the parents (ancestors) of the node while a condition is true. Throws if the initial parent doesn't match the condition.

      Parameters

      • condition: (parent: Node, node: Node) => boolean

        Condition that tests the parent to see if the expression is true.

      • Optionalmessage: string | (() => string)

      Returns Node

    • Gets the source file text position where the node starts that includes the leading trivia (comments and whitespace).

      Returns number

    • Gets the previous sibling.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Optional condition for getting the previous sibling.

      Returns T | undefined

    • Gets the previous sibling.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Optional condition for getting the previous sibling.

      Returns Node<tsc.Node> | undefined

    • Gets the previous sibling or throws.

      Type Parameters

      Parameters

      • Optionalcondition: (node: Node) => node is T

        Optional condition for getting the previous sibling.

      • Optionalmessage: string | (() => string)

      Returns T

    • Gets the previous sibling or throws.

      Parameters

      • Optionalcondition: (node: Node) => boolean

        Optional condition for getting the previous sibling.

      • Optionalmessage: string | (() => string)

      Returns Node

    • Gets the source file text position where the node starts that does not include the leading trivia (comments and whitespace).

      Parameters

      • OptionalincludeJsDocComments: boolean

        Whether to include the JS doc comments.

      Returns number

    • Gets the line number at the start of the node.

      Parameters

      • OptionalincludeJsDocComments: boolean

        Whether to include the JS doc comments or not.

      Returns number

    • Gets the position of the start of the line that this node starts on.

      Parameters

      • OptionalincludeJsDocComments: boolean

        Whether to include the JS doc comments or not.

      Returns number

    • Gets the compiler symbol or undefined if it doesn't exist.

      Returns Symbol | undefined

    • Gets the symbol or throws an error if it doesn't exist.

      Parameters

      • Optionalmessage: string | (() => string)

      Returns Symbol

    • 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.

      Parameters

      Returns Symbol[]

    • Gets the text without leading trivia (comments and whitespace).

      Parameters

      • OptionalincludeJsDocComments: boolean

        Whether to include the js doc comments when getting the text.

      Returns string

    • Gets the text without leading trivia (comments and whitespace).

      Parameters

      • options: { includeJsDocComments?: boolean; trimLeadingIndentation?: boolean }

        Options for getting the text.

      Returns string

    • Gets the text position of the next significant token or new line.

      Returns number

    • Gets the text length from the end of the current node to the next significant token or new line.

      Returns number

    • Gets the type of the node.

      Returns Type

    • Gets the text length of the node without trivia.

      Parameters

      • OptionalincludeJsDocComments: boolean

        Whether to include the JS doc comments in the width or not.

      Returns number

    • Gets if this is the first node on the current line.

      Returns boolean

    • Gets if the specified position is within a string.

      Parameters

      • pos: number

        Position.

      Returns boolean

    • Gets if this node is in a syntax list.

      Returns boolean

    • Prepends the specified whitespace to current node.

      Parameters

      • textOrWriterFunction: string | WriterFunction

        Text or writer function.

      Returns void

    • Prints the node using the compiler's printer.

      Parameters

      Returns string

    • 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.

      Parameters

      • textOrWriterFunction: string | WriterFunction

        Text or writer function to replace with.

      Returns Node

      The new node.

      This will replace the text from the Node#getStart(true) position (start position with js docs) to Node#getEnd(). Use Node#getText(true) to get all the text that will be replaced.

    • 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.

      Parameters

      Returns Node

      sourceFile.transform(traversal => {
      const node = traversal.visitChildren(); // recommend always visiting the children first (post order)
      if (ts.isNumericLiteral(node))
      return ts.createNumericLiteral((parseInt(node.text, 10) + 1).toString());
      return node;
      });
      const classDec = sourceFile.getClassOrThrow("MyClass");
      classDec.transform(traversal => {
      const node = traversal.currentNode;
      return ts.updateClassDeclaration(node, undefined, undefined, ts.createIdentifier("MyUpdatedClass"), undefined, undefined, []);
      });
    • Gets if the compiler node was forgotten.

      This will be true when the compiler node was forgotten or removed.

      Returns boolean