Skip to content

feat!: restrict typescript peer dependency to >=5.5 <7 - #71

Merged
colinaaa merged 1 commit into
mainfrom
colin/restrict-ts-peer-dep
Sep 4, 2026
Merged

colinaaa merged 1 commit into
mainfrom
colin/restrict-ts-peer-dep

Conversation

@colinaaa

@colinaaa colinaaa commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Restrict the typescript peer dependency from "*" to ">=5.5 <7".

Motivation

TypeScript 7 is rewritten in Go and no longer exposes the JavaScript programmatic API (createProgram, ModuleResolutionKind, createSourceFile, etc.). The @arethetypeswrong/core package relies on these APIs at runtime.

During bundling, Rslib externalizes typescript (because it is declared as a peer dependency), producing:

import typescript from "typescript";

in dist/@arethetypeswrong/core.js. At runtime this resolves to whatever typescript the consumer has installed. If that is TypeScript 7, all API calls return undefined and the plugin crashes.

Breaking Change

Consumers who have typescript >= 7 as their only installed TypeScript will see a peer dependency warning. They need to ensure a TypeScript 5.x or 6.x is available for this plugin.

Using TypeScript 6 side-by-side with TypeScript 7

If you are migrating to TypeScript 7 (tsgo) for compiling your own code, you can run TypeScript 6 side-by-side using the official compatibility package:

npm install -D typescript@npm:@typescript/typescript6@^6.0.0

This keeps typescript resolving to v6 for tools that depend on the JS API, while you use tsgo (or @typescript/native-preview) for builds and editor support.

Future

Once @arethetypeswrong/core adds TypeScript 7 support (expected after the stable programmatic API ships in TypeScript 7.1), this constraint will be relaxed.

BREAKING CHANGE: The typescript peer dependency is narrowed from "*" to
">=5.5 <7". TypeScript 7 is rewritten in Go and no longer exposes the
JavaScript programmatic API (createProgram, ModuleResolutionKind, etc.)
that @arethetypeswrong/core relies on at runtime. Installing this plugin
with only TypeScript 7 available will cause runtime failures.

If you are migrating to TypeScript 7 (tsgo) for compiling your own code,
you can run TypeScript 6 side-by-side using the official compatibility
package:

  npm install -D typescript@npm:@typescript/typescript6@^6.0.0

This keeps "typescript" resolving to v6 for tools that depend on the JS
API, while you use tsgo (or @typescript/native-preview) for builds and
editor support.

Once @arethetypeswrong/core adds TypeScript 7 support (expected after
the stable programmatic API ships in TypeScript 7.1), this constraint
will be relaxed.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@colinaaa
colinaaa merged commit 2507040 into main Sep 4, 2026
6 checks passed
@colinaaa
colinaaa deleted the colin/restrict-ts-peer-dep branch September 4, 2026 07:04
@colinaaa colinaaa mentioned this pull request Sep 4, 2026
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.

1 participant