What happens
A JavaScript/TypeScript call to a built-in method on a value whose type isn't resolved links to any project method with that name:
// src/cart.ts
export class Cart {
add(item: string): void {}
map(f: (x: string) => string): string[] { return []; }
}
// src/tidy.ts
export function tidy(list: string[], seen: Set<string>) {
seen.add('x');
return list.map((x) => x.trim());
}
After codegraph init, the graph has tidy → Cart::map as calls. list.map is Array.prototype.map. On larger code the same shape links this.#items.add(x) on a Set to a project class's add, so the callers, impact and trace of such a method fill with unrelated call sites.
Why
isUnresolvedJsMemberCall only declines member calls with three or more segments (a.b.c). A two-segment list.map whose receiver can't be typed falls through to the method-name strategies, which accept any same-named method.
Expected
When the receiver's type is unknown and the method is a JavaScript built-in (Array, Map/Set, Promise, String, Function, EventTarget/EventEmitter, iterators), the call stays unresolved. A receiver that is typed still resolves normally.
A fix we're running
Our fork declines those calls when the receiver is not this/super and the method name is in a built-in method table: bompus#151. On our gate corpora it only removed edges to project methods named like built-ins. Happy to open a PR against main if you'd like this direction.
What happens
A JavaScript/TypeScript call to a built-in method on a value whose type isn't resolved links to any project method with that name:
After
codegraph init, the graph hastidy → Cart::mapascalls.list.mapisArray.prototype.map. On larger code the same shape linksthis.#items.add(x)on a Set to a project class'sadd, so the callers, impact and trace of such a method fill with unrelated call sites.Why
isUnresolvedJsMemberCallonly declines member calls with three or more segments (a.b.c). A two-segmentlist.mapwhose receiver can't be typed falls through to the method-name strategies, which accept any same-named method.Expected
When the receiver's type is unknown and the method is a JavaScript built-in (Array, Map/Set, Promise, String, Function, EventTarget/EventEmitter, iterators), the call stays unresolved. A receiver that is typed still resolves normally.
A fix we're running
Our fork declines those calls when the receiver is not
this/superand the method name is in a built-in method table: bompus#151. On our gate corpora it only removed edges to project methods named like built-ins. Happy to open a PR againstmainif you'd like this direction.