You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
findFirstNodeAbove should check original node #1622
exportfunctionfindFirstNodeAbove<Textendsts.Node>(node: ts.Node,callback: (n: ts.Node)=>n is T): T|undefined{
letcurrent=node;
while(current.parent){
if(callback(current.parent)){
returncurrent.parent;
}else{
current=current.parent;
}
}
}
current may be a Synthesized node and has no parent attribute. This cause isInAsyncFunction return false incorrectly.
a possible fix:
export function findFirstNodeAbove<T extends ts.Node>(node: ts.Node, callback: (n: ts.Node) => n is T): T | undefined {
let current = ts.getOriginalNode(node);
while (current.parent) {
if (callback(current.parent)) {
return current.parent;
} else {
current = ts.getOriginalNode(current.parent);
}
}
}
Activity
RealColdFry commentedon Apr 16, 2026
looking for more synth node leaks...