Skip to content

@typescript/typescript6 does not proxy subpath imports #63422

@christopher-buss

Description

@christopher-buss

🔎 Search Terms

@typescript/typescript6, tsserverlibrary, typescript7 beta alias, typescript@npm:@typescript/typescript6, Cannot find module 'typescript/lib/tsserverlibrary', project-service createProjectService

🕗 Version & Regression Information

This is an issue with @typescript/typescript6@6.0.0 (the only version published, 2026-04-16). There is no prior version to compare against.
The package was introduced alongside the TypeScript 7.0 beta announcement as the recommended aliasing target for consumers that want TS 6.0 semantics to continue while migrating to the TS 7.0 native-preview tsgo binary.
I reviewed the FAQ and searched the issue tracker for typescript6 and tsserverlibrary + alias and found no existing reports.

⏯ Playground Link

Not applicable.

💻 Code

// package.json
{
  "devDependencies": {
    "typescript": "npm:@typescript/typescript6@6.0.0",
    "@typescript-eslint/parser": "8.58.1",
    "@typescript-eslint/project-service": "8.58.1"
  }
}

🙁 Actual behavior

$ node -e "require('typescript/lib/tsserverlibrary')"
node:internal/modules/cjs/loader:...
Error: Cannot find module 'typescript/lib/tsserverlibrary'
Require stack:
- .../node_modules/typescript/lib/ (stub has only typescript.js, typescript.d.ts, tsc.js)

@typescript/typescript6@6.0.0 ships three files: lib/typescript.js, lib/typescript.d.ts, lib/tsc.js. package.json has no exports map, so subpath imports resolve directly against lib/. There is no lib/tsserverlibrary.js, lib/tsserver.js, lib/tsvfs.js, etc.

Any tool that uses a subpath require fails. The real-world impact is that @typescript-eslint/parser with the default projectService: true config errors on every .ts file with Parsing error: Cannot find module 'typescript/lib/tsserverlibrary'. The failing line is const tsserver = require('typescript/lib/tsserverlibrary') in @typescript-eslint/project-service/src/createProjectService.ts.

So the alias that the TS 7.0 blog recommends as a compatibility path for exactly this class of tool seems to breaks exactly that class of tool from my own experience.

🙂 Expected behavior

@typescript/typescript6 is documented as the forward-compatible home for the TS 6.0 compiler and API. Tools that currently work against typescript@6.x should continue to work when typescript is aliased to @typescript/typescript6, including subpath imports.

Additional information about the issue

Workaround in consumer repos while this is unfixed: apply this pnpm patchedDependencies / patch-package patch:
patches/@typescript__typescript6@6.0.0.patch:

diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts
new file mode 100644
--- /dev/null
+++ b/lib/tsserverlibrary.d.ts
@@ -0,0 +1,2 @@
+import ts = require("./typescript.js");
+export = ts;
diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js
new file mode 100644
--- /dev/null
+++ b/lib/tsserverlibrary.js
@@ -0,0 +1 @@
+module.exports = require("./typescript.js");

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