Skip to content

Alias the @types/vscode devDependency to @types/positron-vscode - #27

Merged
melissa-barca merged 1 commit into
mainfrom
14710-vscode-types-alias
Jul 23, 2026
Merged

Alias the @types/vscode devDependency to @types/positron-vscode#27
melissa-barca merged 1 commit into
mainfrom
14710-vscode-types-alias

Conversation

@melissa-barca

Copy link
Copy Markdown
Collaborator

Positron and Posit Assistant build these packages as workspace members, so npm hoists their devDependencies into the consuming repo's root node_modules. At its real name the package occupies node_modules/@types/vscode, and in Positron core, which provides the vscode API as an ambient module from src/vscode-dts/vscode.d.ts, every import ... from 'vscode' then resolves to the DefinitelyTyped copy instead, producing duplicate-identifier errors across the program.

Renames the devDependency to "@types/positron-vscode": "npm:@types/vscode@^1.100.0" and points the tsconfig types arrays at the aliased name, so the hoisted copy sits on a path that module resolution for 'vscode' never consults. The DefinitelyTyped package is a single ambient declare module 'vscode', so a types entry includes it without module-path resolution; tsconfig.declarations.json and tsconfig.positron.json already consumed it that way.

Verified with build, check-types (including the typechecks shape guard), tests, and lint. In Positron, a fresh compile of core and all built-in extensions with the aliased package hoisted to the root and @types/vscode absent reports 0 errors.

Workspace consumers (Positron, Posit Assistant) hoist the packages'
devDependencies into their root node_modules. At its real name the
package occupies the node_modules/@types/vscode path, so a host that
provides the vscode API as an ambient module (Positron core) resolves
'import ... from vscode' to the stale DefinitelyTyped copy instead,
producing duplicate-identifier errors. Positron currently works around
this by deleting the package in its postinstall.

Under the alias, module resolution never consults the package; the
tsconfigs include its ambient 'declare module vscode' explicitly via
the types array, the pattern tsconfig.declarations.json and
tsconfig.positron.json already used.
@melissa-barca
melissa-barca requested a review from wch July 23, 2026 21:43
@melissa-barca
melissa-barca merged commit cb28d1d into main Jul 23, 2026
8 of 16 checks passed
@melissa-barca
melissa-barca deleted the 14710-vscode-types-alias branch July 23, 2026 21:50
melissa-barca added a commit to posit-dev/positron that referenced this pull request Jul 23, 2026
ai-lib cb28d1d renames its @types/vscode devDependency to the aliased
@types/positron-vscode (posit-dev/ai-lib#27), so the hoisted package no
longer occupies node_modules/@types/vscode and core's 'vscode' imports
bind to the ambient src/vscode-dts/vscode.d.ts without help. Remove
pruneRootVscodeTypes() and its calls; the pin also picks up ai-lib
#24-#26 (bridge build-coordinator changes).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants