Skip to content

[Bug]: TypeScript factory methods and local functions lose their call ownership #5593

Done

Description

@rvitaliy

What happened?

A TypeScript factory can return a named method whose body calls a local helper. Graphify omits the method and the function-valued const. As a result, the graph can show that constructing the object calls a dependency that only runs when the method is invoked.

Steps to reproduce

Create store.ts:

export function load() { return 1; }

Create factory.ts:

import { load as readStore } from './store';
export function make() {
  const helper = () => readStore();
  return { read: () => helper() };
}

Run graphify extract . --code-only --no-cluster and inspect graphify-out/graph.json.

The graph shows make() → load() at line 3. I expected make() to own helper() and .read(), with calls edges from .read() to helper() and from helper() to load().

I reproduced this on v8 at a7295bcaafb6ba003629dc7103178263d571f306 using Python 3.14.10 on macOS arm64.

The local arrow and returned object property cases were both raised in #2143. #4767 covered lexical scoping for nested function declarations.

Activity

  1. github-actions commented on Nov 28, 2026

    @github-actions

    Thanks for opening this issue, @rvitaliy. 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.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions