Skip to content

feat(types): prefer MemberOfUnion, retain deprecated LastOfUnion (CORE-26) - #19

Draft
YLfjuk wants to merge 2 commits into
mainfrom
feat/core-26-member-of-union
Draft

YLfjuk wants to merge 2 commits into
mainfrom
feat/core-26-member-of-union

Conversation

@YLfjuk

@YLfjuk YLfjuk commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

LastOfUnion implies an ordering that unions do not guarantee. Add MemberOfUnion with the exact existing selection algorithm and keep LastOfUnion as a deprecated compatibility alias, preserving its source path and both public package exports. Document unspecified, compiler-dependent selection and never behavior. UnionToTuple uses the new name with unchanged recursion; its example and tests no longer promise an order.

Add compiled assertions for a non-never single member, singleton/empty unions, booleans, collapsed unions, alias compatibility, tuple membership/length, and types/core imports. Add one package-neutral Changesets note for types and core. Changesets also plans a dependent utils patch; no versions or historical changelogs were edited. The new API uses @since @next pending release versioning.

Validation on Windows, Node 24.19.0 / pnpm 11.22.0 / TypeScript 7.0.2:

  • Frozen install, formatting, lint, forced source typechecks, tests, coverage, forced builds, publint, attw esm-only, Changesets status, and diff checks pass. Lint retains ten existing warnings. Tests: 67 files, 347 passes, five existing TODOs. Coverage: 100% statements/branches/lines, 96.42% functions.
  • All four focused specs compile directly with strict tsc --ignoreConfig --noEmit --target ES2024: ESNext/bundler with the dev-source condition, plus ESNext/bundler and NodeNext/NodeNext with built public exports. Zero diagnostics or unresolved imports; no suppressions, path aliases, or skipLibCheck. These checks compile assertions independently of main's existing Vitest discovery gap.
  • The optional NodeNext check with the dev-source condition fails on existing extensionless imports in utils; the built-export NodeNext check passes.
  • pnpm audit fails on the unchanged dependency graph: 17 advisories, comprising three critical, four high, nine moderate, and one low. This exceeds CORE-02's older snapshot and remains outside this change.

Independent branch from main e195ff7d9aca4e702b098744a52d5ca29bd3e9cc; head 2b963309e902eeb01e88a959ccfac4d536915051. No CORE-25 optimization, test-discovery configuration, enum assertions, or unrelated audit fixes. PRs #16/#17/#18 are untouched; HQ should reconcile their overlapping union tests/JSDoc and run independent review. No external reviews or merge actions requested.

Review follow-up at 11876c29af8f45216b66d2e7c210491a32d20963: replace the permissive tuple assignability probes with IsDisjointUnion<Actual> === false for literal and boolean unions. Direct strict compiler checks pass in the three source/built modes above. Temporary whole-union and boolean replacements each produce the expected TS2344 error, proving the assertions reject that regression. Formatting and whitespace checks pass. Clarify that member selection may differ between compiler versions and programs. The selection algorithm, alias and package configuration are unchanged; the earlier full-suite results remain scoped to 2b96330.

PR #17 owns the separate UnionToTuple order-clarification release note and enum-helper removal. Reconcile its JSDoc plus PR #16's test changes when landing this PR after them. Replace MemberOfUnion's @since @next with the actual version when the Changesets release PR establishes it; no release version is guessed here. Opus correctness and Sonnet documentation re-reviews are complete at 11876c2, with no new findings. Both independently reproduced the negative assertions and direct compiler checks. CI passes every validation step except the unchanged dependency audit.

@changeset-bot

changeset-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

馃 Changeset detected

Latest commit: 11876c2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@ylfjuk-core/types Patch
@ylfjuk/core Patch
@ylfjuk-core/utils Patch

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

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