Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/calm-tools-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stll/typescript-config": patch
---

Support direct TypeScript 7 and split TypeScript 6 compatibility installs.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,20 @@ newer, and oxlint-tsgolint 7.0.2001 or newer. Pin the current versions from
`@stll/typescript-config/toolchain.json`; do not use the deprecated
oxlint-tsgolint 0.x line.

TypeScript 6 is compatibility-only. A repository may keep it under the
`typescript` package name only for a command that loads one of the peer
blockers listed in `toolchain.json`. Code that imports the compiler API must
use the manifest's `typescript-compat` package alias instead. The normal
compiler remains TypeScript 7; install it directly or under an alias such as
`@typescript/native`. Remove each compatibility install when its listed
blocker or API consumer accepts TypeScript 7.
`toolchain.json` defines two supported TypeScript install layouts:

- `direct` installs TypeScript 7 as `typescript` and runs the normal `tsc`
binary. Prefer this when every framework and compiler-API consumer supports
TypeScript 7.
- `split-compatibility` keeps TypeScript 6 as `typescript` for incompatible
compiler-API consumers, then installs TypeScript 7 as `@typescript/native`
and invokes that binary for typechecking.

TypeScript 6 is compatibility-only. Use the split layout only for a command
that loads one of the peer blockers listed in `toolchain.json`, or for code
that imports the TypeScript compiler API. Remove the compatibility install when
the blocker accepts TypeScript 7. The shared config's peer range accepts both
layouts; the compiler and typecheck command in each layout remain TypeScript 7.
Comment on lines +48 to +49

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Route the recommended split script to TypeScript 7

For consumers selecting split-compatibility, the later “Recommended scripts” block still sets typecheck to tsc --noEmit (README.md:132-139). Because both the compatibility typescript package and the @typescript/native alias expose a tsc binary, that unqualified shim does not guarantee the TypeScript 7 compiler and may silently run TypeScript 6, despite this section promising that typechecking remains on TypeScript 7. Show the split command from toolchain.json in the scripts guidance or explicitly qualify the existing example as direct-only.

AGENTS.md reference: AGENTS.md:L156-L156

Useful? React with 👍 / 👎.


Use the library TypeScript preset:

Expand Down
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 26 additions & 8 deletions packages/oxlint-config/src/toolchain-policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ describe("shared toolchain policy", () => {
oxlint: "1.75.0",
"oxlint-tsgolint": "7.0.2001",
typescript: "7.0.2",
typescriptInstallLayouts: [
{
compilerPackage: "typescript",
compilerSpecifier: "7.0.2",
type: "direct",
typecheckCommand: "tsc --noEmit",
},
{
compatibilityPackage: "typescript",
compatibilitySpecifier: "6.0.3",
compilerPackage: "@typescript/native",
compilerSpecifier: "npm:typescript@7.0.2",
type: "split-compatibility",
typecheckCommand:
"node ./node_modules/@typescript/native/bin/tsc --noEmit",
},
],
typescript6Compatibility: {
apiConsumers: ["TypeScript compiler API"],
packageAlias: "typescript-compat",
Expand All @@ -38,13 +55,8 @@ describe("shared toolchain policy", () => {
});
});

test("rejects pre-TS7 compiler and tsgolint consumers", async () => {
const oxlintPackage = await readJson(
"packages/oxlint-config/package.json",
);
const typescriptPackage = await readJson(
"packages/typescript-config/package.json",
);
test("rejects pre-TS7 tsgolint consumers", async () => {
const oxlintPackage = await readJson("packages/oxlint-config/package.json");

expect(oxlintPackage).toEqual(
expect.objectContaining({
Expand All @@ -54,11 +66,17 @@ describe("shared toolchain policy", () => {
},
}),
);
});

test("supports both TypeScript install layouts", async () => {
const typescriptPackage = await readJson(
"packages/typescript-config/package.json",
);

expect(typescriptPackage).toEqual(
expect.objectContaining({
peerDependencies: {
typescript: ">=7.0.2 <8",
typescript: ">=6.0.3 <8",
},
}),
);
Expand Down
6 changes: 3 additions & 3 deletions packages/typescript-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"./bun.json": "./bun.json",
"./toolchain.json": "./toolchain.json"
},
"peerDependencies": {
"typescript": ">=7.0.2 <8"
},
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"typescript": ">=6.0.3 <8"
Comment thread
jan-kubica marked this conversation as resolved.
}
}
16 changes: 16 additions & 0 deletions packages/typescript-config/toolchain.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
"typescript": "7.0.2",
"oxlint": "1.75.0",
"oxlint-tsgolint": "7.0.2001",
"typescriptInstallLayouts": [
{
"type": "direct",
"compilerPackage": "typescript",
"compilerSpecifier": "7.0.2",
"typecheckCommand": "tsc --noEmit"
},
{
"type": "split-compatibility",
"compilerPackage": "@typescript/native",
"compilerSpecifier": "npm:typescript@7.0.2",
"compatibilityPackage": "typescript",
"compatibilitySpecifier": "6.0.3",
"typecheckCommand": "node ./node_modules/@typescript/native/bin/tsc --noEmit"
Comment thread
jan-kubica marked this conversation as resolved.
}
],
"typescript6Compatibility": {
"version": "6.0.3",
"packageAlias": "typescript-compat",
Expand Down
Loading