Function getClosestAncestor

  • Returns the closest ancestor of the given nodes.

    Since only one node is given, the node will be returned as is.

    Type Parameters

    • A extends Node

    Parameters

    • a: A

    Returns A

  • Returns the closest ancestor of the given nodes.

    If the nodes are all the same node, the given node will be returned.

    If the given nodes are not part of the same AST tree, an error will be thrown.

    Type Parameters

    • A extends Node

    • B extends Node

    Parameters

    • a: A
    • b: B

    Returns ClosestAncestor<A, B>

  • Returns the closest ancestor of the given nodes.

    If the nodes are all the same node, the given node will be returned.

    If the given nodes are not part of the same AST tree, an error will be thrown.

    Type Parameters

    • A extends Node

    • B extends Node

    Parameters

    • a: A
    • Rest ...b: B[]

    Returns ClosestAncestor<A, B>

  • Returns the closest ancestor of the given nodes.

    If the nodes are all the same node, the given node will be returned.

    If the given nodes are not part of the same AST tree, an error will be thrown.

    Type Parameters

    • T extends Node

    Parameters

    • Rest ...args: T[]

    Returns ClosestAncestor<T, T> | undefined