Skip to content

API server reports TS2345 for a call that tsc accepts on the same project #64635

Description

Repro: https://github.com/vivere-dally/tsgo-api-ts2345-repro

@typescript/native (typescript) 7.0.2, darwin-arm64, node v24.21.0, macOS 26.5.1. The project uses sigma 3.0.3 and @sigma/utils 3.0.0. strict is not set.

Steps

  1. npm install
  2. npm run probe. The script starts 25 fresh node processes. Each process makes one new API({ cwd }) of @typescript/native/unstable/sync, calls updateSnapshot once, and reads program.getSemanticDiagnostics() once.
  3. npm run batch. The script runs tsc -p tsconfig.app.json 25 times.

Expected

The server and tsc give the same diagnostics for the same project and options.

Actual

  • tsc: 0 of 25 runs report an error. Classic typescript 6.0.3 also reports no error.
  • The server: 25 of 25 processes report TS2345. An earlier run gave 209 of 210.
error TS2345: Argument of type 'GraphRenderer' is not assignable to parameter of
type 'Sigma<Attributes, Attributes, Attributes>'.
  The types returned by 'getSettings()' are incompatible between these types.

The call is fitViewportToNodes(renderer, []) in src/widgets/graph-canvas/canvas-setup.ts.

Observations

  • One process gives the same answer in five queries. Thus the difference comes from program or checker construction.
  • The project needs both source files. With the caller merged into canvas-setup.ts, 0 of 20 processes report the error.
  • Without the typed constant emptyDrawer, tsc also reports TS2345. With the constant, tsc accepts the call, and the server does not.
  • In the full application that this comes from, about one server process in four reports the error.

The server result seems to depend on the order of type checks. I do not know which of the two answers is correct.

Activity

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