Skip to content

feat: add a union type-guard combinator#444

Merged
gjbkz merged 1 commit into
mainfrom
437-union-type-guard-combinator
Jul 20, 2026
Merged

feat: add a union type-guard combinator#444
gjbkz merged 1 commit into
mainfrom
437-union-type-guard-combinator

Conversation

@gjbkz

@gjbkz gjbkz commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

  • add the generic union() TypeGuard combinator with zero-, one-, and many-guard semantics
  • preserve branch diagnostics and stable issue ordering for validate() and validateAll()
  • export and document the new API with runtime and type-inference coverage

Tests

  • npm run lint
  • npm run test:type
  • node --test src/union.test.ts
  • npm run test:unit
  • npx c8 npm run test
  • bun test src --coverage --coverage-reporter=lcov
  • npm run build
  • ESM and CommonJS package-entry smoke tests

Closes #437

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.71795% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.73%. Comparing base (cf19875) to head (90ddd5e).

Files with missing lines Patch % Lines
src/union.ts 98.68% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #444      +/-   ##
==========================================
+ Coverage   97.70%   97.73%   +0.02%     
==========================================
  Files          49       50       +1     
  Lines        2620     2698      +78     
  Branches      275      292      +17     
==========================================
+ Hits         2560     2637      +77     
- Misses         60       61       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gjbkz
gjbkz merged commit 7dfba76 into main Jul 20, 2026
8 checks passed
@gjbkz
gjbkz deleted the 437-union-type-guard-combinator branch July 20, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

feat: add a union type-guard combinator

1 participant