Repository navigation
Check TypeScript 7 compatibility in pnpm check - #255
Merged
Merged
Conversation
4 of 5 tasks
Pin the native TypeScript 7 compiler in a private tooling workspace package so its tsc binary does not replace the TypeScript 6 toolchain, type-check every package project and the test project with it, and compile the packed consumer fixture with both compilers. Fix the Machine test snapshot helpers so TypeScript 7 infers their type parameters from the unwrapped snapshot rather than from the root-wrapper union member. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SandroMaglione
force-pushed
the
typescript-7-compatibility
branch
from
November 1, 2026 09:16
f41ab92 to
afe650d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pnpm check, so both thecheckandlatest-effectCI jobs run it. The root toolchain stays on TypeScript 6.0.3 because TypeDoc, tstyche, and the repository scripts need the JavaScript compiler API.tsconfig.tests.jsonreported TS2379 atpackages/effect-machine/test/machine/Machine.test.ts:831(Property 'code' is missing in type 'Payment' but required in type 'AuthorizedPayment').Root cause: the test helper, not the library types
The library types are not involved. Under both compilers,
planned.state.stateisCompoundSnapshot<"payment", Payment, SnapshotWithPrefix<…>>, and it is assignable in both directions to the hand-writtenCompoundSnapshot<"payment", Payment, AtomicSnapshot<"payment.entering", EnteringPayment> | AtomicSnapshot<"payment.authorized", AuthorizedPayment>>. I checked this with a throwaway probe under 6.0.3 and 7.0.2.The problem is the signature of
assertCompoundStateSnapshot. Itsactualparameter isCompoundSnapshot<Path, Value, Child> | CompoundSnapshot<"", undefined, CompoundSnapshot<Path, Value, Child>>. A non-root compound snapshot structurally matches both union members. Inference against the root-wrapper member reads candidates out of the child union (payment.entering/payment.authorized,EnteringPayment/AuthorizedPayment):Path = "payment" | "payment.entering" | "payment.authorized", which is wrong.Valuehappens to come out asPaymentonly because of candidate order.ValuebecomesAuthorizedPaymentand the call fails.The fix wraps the root-wrapper member in
NoInferin all three helpers (assertStateSnapshot,assertCompoundStateSnapshot,assertParallelStateSnapshot). That way only the unwrapped snapshot and the explicit arguments drive inference. Consumers are not affected, so there is no library change.TypeScript 7 lane
typescript7: npm:typescript@7.0.2in the root does not work. pnpm resolves thetscbin conflict by the higher version, so the roottscsilently became 7.0.2. Instead, a private workspace package,tooling/typescript-7, pinstypescript@7.0.2in its ownnode_modules. The root and packagetscstay 6.0.3 (checked).pnpm typecheck:ts7: type-checks the four package projects (--noEmit) andtsconfig.tests.jsonwith TypeScript 7. It runs inpnpm checkright afterpnpm typecheck, which emits the declarations the project references need. It takes about 11 s cold and about 3 s warm; the TypeScript 6pnpm typechecktakes about 64 s cold. That speed is why it runs inpnpm checkinstead of a separate job.pnpm test:consumer: now compiles the packed consumer with TypeScript 6 and then with the pinned TypeScript 7.TSGO_BINstill overrides the TypeScript 7 binary.>=5.4 <7.0, so type assertions stay TypeScript 6 only. Only8.0.0-beta.0exists beyond that. This is documented inCONTRIBUTING.md.latest-effect: its steps are unchanged.scripts/prepare-effect-compatibility.mjsonly rewrites the root andpackages/*manifests. Because the lane is part ofpnpm check, that job now also runs the TypeScript 7 checks.Changeset
This PR has an empty changeset (
.changeset/typescript-7-compatibility-lane.md, created withchangeset add --empty) and nothing more.scripts/check-changeset.mjsrequires a changeset for any rootpackage.jsonchange, and this PR edits root scripts. An empty changeset releases nothing, the site's changelog parser ignores it, andchangeset versionjust deletes it (checked locally).Validation
pnpm checkpassed in 2:20: format, architecture, CI scripts, API and site docs, TypeScript 6 typecheck, TypeScript 7 typecheck, build, 92 files / 901 tests, 41 tstyche files / 281 tests (1334 assertions), consumer with TypeScript 6 and 7, and all four pack checks.pnpm typecheck:ts7exits 1 with the TS2379 above, so the lane catches it.srcchanges.🤖 Generated with Claude Code