microsoft / microsoft/TypeScript

Local auto-imports disappear when a Yarn workspace dependency resolves a subpath back to the current project

Abierto
#63,852 1 comentario 4 reacciones 1 asignado Ver en GitHub

@andrewbranch ya está trabajando en esto.

Desde el 15/7/2026.

Needs Investigation
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

Extension Version

0.20260708.2 (TypeScript 7.0.2)

VS Code Version

1.128.0 (arm64)

Operating system Version

macOS 26.5.1 (25F80), Apple Silicon

Steps to reproduce

Use the attached typescript-go-local-autoimport-repro folder. It contains two synthetic Yarn workspaces and no application code.

typescript-go-local-autoimport-repro.zip

corepack enable
yarn install
yarn probe

The repository uses Yarn 4.13.0 with nodeLinker: node-modules, TypeScript 7.0.2, and TypeScript 6.0.2 as a control. The TypeScript packages use npm aliases only to prevent Yarn from applying its legacy built-in TypeScript patch.

Expected probe output while the bug is present:

TS7 7.0.2: localValue MISSING
TS7 7.0.2: LocalType MISSING
TS7 bug reproduced.
TS6 6.0.2: localValue FOUND from ./local-symbols
TS6 6.0.2: LocalType FOUND from ./local-symbols
TS6 control passed.

For a manual editor reproduction:

  1. Install and enable the TypeScript 7 extension.
  2. Open the reproduction folder. Its workspace setting enables TypeScript 7.
  3. Open packages/aurora-app/src/consumer.ts.
  4. Type localVal and invoke completions. localValue is not suggested.
  5. Type const sample: LocalTy and invoke completions. LocalType is not suggested.
  6. Disable TypeScript 7 and restart the TypeScript language service. Both symbols are suggested from ./local-symbols by TypeScript 6.
Issue

Package resolution and typechecking work. The missing suggestions are ordinary relative imports between files in the same configured project.

The minimal dependency topology is:

aurora-app -> comet-kit -> aurora-app/back-reference

aurora-app imports @demo/comet-kit. The comet-kit source imports one exported subpath back from @demo/aurora-app. Yarn links both workspaces under the root node_modules.

With the back-reference present, the TypeScript 7 project auto-import bucket contains zero exports from aurora-app, so localValue and LocalType disappear. TypeScript 6 finds both relative imports.

As a control, replace packages/comet-kit/src/index.ts with:

export const packageValue = "package-value";

After restarting TypeScript 7, both local suggestions return. This isolates the regression to the resolved workspace back-reference rather than the tsconfig or the exports themselves.

I suspect the project-bucket optimization is treating the current project as fully covered by a node_modules bucket after recording the back-reference symlink:

https://github.com/microsoft/typescript-go/blob/168e7015edf98244febc8f4ae450b673b5d195d7/internal/ls/autoimport/registry.go#L1236-L1253

This is an inference from the minimal A/B reproduction, not a confirmed implementation fix.

Related issues do not appear to cover this exact case:

  • microsoft/typescript-go#1657 concerns missing package imports from linked workspaces; package imports work here.
  • microsoft/typescript-go#2582 concerns invalidating cached exports after edits to a symlinked workspace package; this fails during initial discovery of the current project's own files.
  • microsoft/TypeScript#63803 concerns package subpath specifiers across local packages; the missing suggestions here should use an ordinary relative path within one configured project.
  • microsoft/typescript-go#3733 concerned new-file and wildcard-directory discovery and was fixed by microsoft/typescript-go#4529; this reproduces in an existing configured file with extension 0.20260708.2.

Expected: local symbols are suggested / Actual: they are absent

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.