Skip to content

[F] getNodeAtPosition

Call Signature

function getNodeAtPosition(
script,
position,
filter?): Node | undefined

Resolve the node in the syntax tree that that is at the given position.

Parameters

ParameterTypeDescription
scriptTypeSpecScriptNodeTypeSpec Script node
positionnumberPosition
filter?(node) => booleanFilter if wanting to return a parent containing node early.

Returns

Node | undefined

Call Signature

function getNodeAtPosition<T>(
script,
position,
filter): T | undefined

Resolve the node in the syntax tree that that is at the given position.

Type Parameters

Type Parameter
T extends Node

Parameters

ParameterTypeDescription
scriptTypeSpecScriptNodeTypeSpec Script node
positionnumberPosition
filter(node) => node is TFilter if wanting to return a parent containing node early.

Returns

T | undefined