Skip to content

[Bug]: TS typed-receiver calls get no edge when the receiver's type name is defined more than once, even though the caller's import names the exact one #4232

Description

@rohit-jsfreaky

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

In _resolve_typescript_member_calls, a type name defined more than once gives no edge, even when the caller's import names the exact one. The resolver requires the receiver's type name to be unique in the whole corpus (len(type_defs) != 1: continue) before it applies the #2553 origin gate. In hono there are four Contexts: the class in src/context.ts, interfaces in src/jsx/context.ts and src/router/reg-exp-router/node.ts, and a type in src/jsx/dom/render.ts. So every c.header(), c.text(), c.json() in a file that does import type { Context } from '../../context' and (c: Context) => ... gets no edge, although the import says which Context it is. Same for Hono (4 definitions) and HonoRequest (2).

Measured against the TypeScript compiler (checker.getSymbolAtLocation at every call inside every named function), 0.9.80, hono src/: obj.method() calls found 15 / 74 (20.3%); 35 of the misses are on Context, 10 on Hono.

Steps to reproduce

mkdir -p demo/jsx && cd demo
printf 'export class Context {\n  header(): number { return 1 }\n}\n' > context.ts
printf 'export interface Context {\n  header(): number\n}\n' > jsx/context.ts
printf 'import type { Context } from "./context"\nexport const setCookie = (c: Context): number => c.header()\n' > cookie.ts
graphify update . --no-cluster
python -c "import json; g=json.load(open('graphify-out/graph.json')); n={x['id']:(x['label'],x.get('source_file')) for x in g['nodes']}; [print(n[e['source']], '->', n[e['target']]) for e in g.get('links', g.get('edges', [])) if e['relation']=='calls']"

Error output or graph output

(nothing printed: no calls edges)

Expected: ('setCookie()', 'cookie.ts') -> ('.header()', 'context.ts'), the class in the file cookie.ts imports.

Graphify version

0.9.80 (6478eb7)

Operating System

Windows

Python Version

3.12

Installation Method

built from source (git clone)

Additional Environment Details

No LLM keys; AST only. Clean checkout of v8 @ 6478eb7 reproduces.

Additional context

The origin gate (#2553) already knows which definitions the caller's file can see; the fix applies it before the uniqueness check instead of after. PR right after this issue.

Activity

  1. github-actions commented on Oct 8, 2026

    @github-actions

    Thanks for opening this issue, @rohit-jsfreaky. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. changed the title [-][Bug]: TS typed-receiver calls: give up when the type name is defined twice, and bind `c.name()` to a private `#name()`[/-] [+][Bug]: TS typed-receiver calls get no edge when the receiver's type name is defined more than once, even though the caller's import names the exact one[/+] on Oct 8, 2026
  3. safishamsi commented on Oct 8, 2026

    @safishamsi
    Member

    Fixed by #4233 (thanks @rohit-jsfreaky), shipped in v0.9.81. Closing as resolved.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions