Repository navigation
Conversation
ssalbdivad
added a commit
that referenced
this pull request
Nov 9, 2026
…uthors Each fix below landed on featherduster from a port or an independent fix, but each started from a reasonable community PR against 2.x, and the CHANGELOG thanks every contributor whose work this release supersedes: - #1721 (@RaphaelFakhri): fast-check keeps a regex's flags (#1720) - #1722 (@louisss1016): Temporal values survive a morph / deepClone (#1719) - #1725 (@RClaudiuM): an undefined discriminant case checks its key (#1724) - #1715 (@SynthLuvr): ~standard.jsonSchema.input drops undefined (#1462); only its input half was taken, output keeps routing to fallback.unit #1718 is not credited: 3.0 answers #1469 with jsonSchema meta rather than its bare pattern key. #1705 and #1695 were already thanked. Also notes that a cyclic index signature with no way out now generates shrinking dictionaries instead of overflowing the stack (6f4dd5d).
Merged
Unions discriminated on a nested path with an undefined case must keep the object and key checks for that case, since data?.a is also undefined for primitives and objects without the key (arktypeio#1724).
RClaudiuM
force-pushed
the
fix/1724-undefined-discriminant-primitive
branch
from
November 18, 2026 08:21
785070c to
96c75a5
Compare
This branch has not been deployed
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.
Refs #1724
Update
The fix for #1724 landed on
mainwith the union rewrite (thanks for the credit in the changelog). I mergedmain, dropped the source change sinceark/sets/roots/union.tsalready handles it, and kept the regression tests, so this PR is now test-only.Tests
In
ark/type/__tests__/discrimination.test.ts, each with JIT andjitless: truewhere it applies:{ k: "1", a: "2" } | { k: "3", a: "undefined" }) rejects0,"s",nullandundefinedwith "must be an object", and still checksk{ a: 2 } | { a: undefined }rejects0and{}and accepts{ a: undefined }, also for a two-level path ({ a: { b: ... } })undefinedcase ({ a: string, b: 1 } | { a: undefined } | { a: number, b: 2 }) rejects primitives and{}and still checksbin the other branchesThey pass on current
main, and the first one throws theTypeErrorfrom the issue on 2.x.Checks run locally:
pnpm testCore(3300 passing),pnpm testFiles ark/type/__tests__/discrimination.test.ts,pnpm typecheckRepo, prettier and eslint on the test file.mainbranch