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
TypeScript/JS: method calls on a typed receiver that is a local new binding or a closure-captured parameter are not emitted as calls edges (v0.9.5) #1630
On TypeScript/JavaScript, a member call x.method() does not produce a calls edge to the receiver type's method when x's type comes from (A) a local const x = new Foo() binding, or (B) a closure over a typed parameter (function f(x: Foo) { return () => x.method() }) — even though the receiver's type is statically known. No caller edge is built in either case, so graphify affected <method> reports "No affected nodes found" for a method that is, in fact, called, and it silently under-reports for refactor-impact ("what breaks if I change this method?").
This is the TypeScript/JS analog of #1609 (C#: typed field/param/local receiver calls not emitted). The TS this.field.method() variant was already fixed in #1316 (closed) / v0.9.3's constructor-injected-dependency resolution — but that fix does not extend to a local new binding or a closure-captured parameter, which this issue covers. (The existing TS/JS _resolve_*_member_calls path handles this./unqualified/static-import calls, same gap #1609 describes for C#.)
Only the container Svc --method--> doThing edge exists; neither usesDirect nor register is linked.
Expected
affected doThing should list usesDirect and register (or the closure); explain doThing should show incoming [calls] edges from both. Both receivers have a statically-known type (new Svc() and the annotated svc: Svc), so the method target is resolvable without whole-program inference.
Why it matters
For refactor-impact ("who calls / what breaks if I change X"), a silent under-report is worse than no answer — the short result looks complete. Real codebases hit both shapes constantly: dependency objects constructed once and reused, and handlers/callbacks that close over an injected service parameter.
Fixed on v8 (4744dfe) — both patterns now resolve.
Pattern A (const s = new Svc(); s.doThing()): the per-file type table now learns local new bindings, so the existing receiver-typed resolver binds s -> Svc.
Pattern B (closure over a typed param, (svc: Svc) => () => svc.doThing()): two parts — the type table now learns bare-typed parameters, and walk_calls descends into an inline/returned closure (attributing its calls to the enclosing function) instead of stopping at the arrow boundary, so the closure's svc.doThing() is captured and resolved.
Kept the single-definition guard, so under ambiguity (two doThing across classes) new Svc() binds to Svc.doThing, never Cache.doThing; an untyped param (x) or a non-bare type (Svc[], unions, generics) produces no edge. Verified on the real graphify extract shape (absolute paths + graphify-out cache). 5 tests, full suite green (2871). Ships next release — thanks for the clean two-pattern repro.
Activity
feat(extract): TS/JS member calls on local new-binding + typed-param …
safishamsi commentedon Jul 3, 2026
Fixed on
v8(4744dfe) — both patterns now resolve.const s = new Svc(); s.doThing()): the per-file type table now learns localnewbindings, so the existing receiver-typed resolver bindss->Svc.(svc: Svc) => () => svc.doThing()): two parts — the type table now learns bare-typed parameters, andwalk_callsdescends into an inline/returned closure (attributing its calls to the enclosing function) instead of stopping at the arrow boundary, so the closure'ssvc.doThing()is captured and resolved.Kept the single-definition guard, so under ambiguity (two
doThingacross classes)new Svc()binds toSvc.doThing, neverCache.doThing; an untyped param (x) or a non-bare type (Svc[], unions, generics) produces no edge. Verified on the realgraphify extractshape (absolute paths +graphify-outcache). 5 tests, full suite green (2871). Ships next release — thanks for the clean two-pattern repro.fix(extract): shadow untracked JS/TS closure params from indirect_cal…
feat(extract): TS/JS member calls on local new-binding + typed-param …
fix(extract): shadow untracked JS/TS closure params from indirect_cal…