in src/lib.ts [407:417]
function loop(node: ts.Node): ts.Node | undefined {
const length = node.end - node.pos;
if (node.pos === textSpan.start && length === textSpan.length) {
return node;
}
if (node.pos <= textSpan.start && textSpanEnd <= node.end) {
const candidate = ts.forEachChild(node, loop);
return candidate || node;
}
return undefined;
}