Repository navigation
perf(types): extend UnionToTuple recursion capacity - #35
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 3a0f1c2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
UnionToTuple currently reaches TS2589 for a 50-member literal union on TypeScript 7.0.2. Use a private tail-recursive accumulator with the existing MemberOfUnion selector; preserve the single-parameter API, mutable tuple result and unspecified order. Add edge-case and 50-member compiler regressions plus a patch changeset.
Measured with Node 24.19.0, pnpm 11.22.0 and exactly TypeScript 7.0.2, three runs per explicit literal union at 10/30/50/100/200 members, alternating implementation order and separate uninstantiated controls. Baseline fails TS2589 at 50/100/200 in every run; candidate passes all inputs. At 10/30, control-adjusted instantiations are 1286/1290 and 8956/8960 baseline/candidate. This improves depth capacity, with four extra instantiations at comparable successful inputs, and makes no general speed claim. Check-time ranges at 30 are .010-.011/.009-.011 seconds; at 200 they are .493-1.350/.825-1.768, but failed baseline work is incomplete and timings are noisy. No maximum size or arbitrary input cap is introduced.
Evaluated @arktype/attest 0.58.0 externally with pinned TS 7.0.2. Its tsgo setup explicitly rejects the compiler: requires TypeScript 7.1+. Native extendedDiagnostics suffice; no dependency or lockfile changes.
Validation: uncached types package build passes all 100 files / 520 tests, strict tsc, publint and attw esm-only. Oxc changed-file lint/format and diff checks pass. Restoring the baseline reproduces TS2589 in the new regression; special-input tests pass. No ordering assertions, unrelated utilities or numeric profiling.
Reproduction artifacts on the implementation machine: C:/Users/yehon/.t3/core25-evidence/report.md, bench.mjs, results.json and raw logs. Run the script from this checkout with the pinned Node/TS environment. Independent correctness and benchmark review pending.
Base verified against fetched origin/main: 18ce908.