Builds a call graph rooted at the named callable.
Name of the callable to analyse. Accepts a method,
function, accessor or arrow-function property name, 'constructor',
or a class-qualified name such as 'AuthInterceptor.constructor' or
'AuthInterceptor.headers'.
Absolute path of the source file containing the callable.
Traversal direction, depth and limits. Defaults to
both / depth 2 / maxNodes 200 / lifecycle hooks excluded.
A CallGraphResult with the target and its caller/callee trees.
Builds caller/callee graphs for methods, functions, constructors, accessors and arrow-function properties across a ts-morph Project. Traverses upward (callers) and downward (callees) with configurable depth.
Supported targets (and graph nodes):
'constructor'or'ClassName.constructor'); a class without an explicit constructor is represented by its field initializersCallees include:
new X()(edge to X's constructor, including X's field initializers)super(...)(edge to the base class constructor)Callers are the enclosing callable of each reference: method, function, constructor, accessor, arrow-function property, or (for references in a field initializer) the owning class constructor. Callers of a constructor are the
new X()sites and the constructors of subclasses.Template callers: for members of an Angular component, the component's own template (inline or
templateUrl) is scanned for calls of the member ((click)="save()",{{ label() }},[x]="compute()"; getters as reads, setters as writes). Each hit becomes a leaf node with kind'template', the template file and line and the source line assnippet. Templates of subclasses (all levels) count as well, withclassNameof the subclass andinheritedFromof the declaring class; a subclass overriding a concrete member takes itself and its descendants out (their templates call the override). Implementations of an abstract member do not.Traversal limits:
maxNodes(default 200) caps the number of nodes across both trees; when hit, traversal stops and the result carriestruncated: true.includeLifecycleHooksis set, the upward traversal does not fan out over polymorphic siblings: declaration sites of other implementations are not callers, and callers of an Angular lifecycle hook orimplements-interface member are limited to the owning class and its subclasses. Without this,findReferencesonngOnInitresolves throughOnInitto everyngOnInitin the program.Remarks
Used in bug investigation to understand how an error propagates through the codebase. Combine with UsageFinder to trace the full call path from the entry point to the failing code, e.g. "what runs transitively while an interceptor is constructed" (ctor -> helper getter -> static config read).
Example