Skip to content

typescript: path calls two functions independent though one makes an unresolved call through a parameter, a loop variable or a computed member #1676

Closed as duplicate

Description

@swapnilpaliwal-sd

Symptom

path A B answers "the two are independent in this graph" in a TypeScript project when A calls through a parameter, a loop variable or a computed member (cb(), h() in a for … of, t[k]()) that nothing in the project supplies. Such a call can reach B, so the connection is unknown, not absent. The same functions in a JavaScript project now answer "UNKNOWN, not absent" and name the site.

Repro (a TypeScript project)

export function alpha(): string { return 'a'; }
export function invoke(cb: () => string): string { return cb(); }
export function runAll(hs: Array<() => void>): void { for (const h of hs) h(); }
export function dispatch(t: Record<string, () => void>, k: string): void { t[k](); }
$ axiomcode path invoke alpha
no chain of resolved calls connects invoke and alpha in either direction (searched 2 edges, depth ≤ 40)
  and no unresolved site would connect them by name either: the two are independent in this graph
next: nothing in this graph connects them — no call, no unresolved site that could, ...

Same answer for path runAll alpha and path dispatch alpha.

Expected

path says the connection is unknown and names the call through the value (cb() at line 2, h() at line 3, t[k]() at line 4), as it does for the same code in JavaScript.

Activity

  1. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Consolidated into #1585, which tracks this issue together with related ones about TypeScript typing and entry points: callbacks, object-literal functions, enums, JSX and package exports. The description and reproduction here still apply, and the fix for the group covers them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingengineResolution / call-graph engine rulestypescriptTypeScript

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions