📝 Check off the primitive-union rename

This commit is contained in:
tmu committed 2026-09-22 09:47:05 +00:00
1 parent 02f736507c
commit a88d49ffe2
1 file changed
+5 -4
+5 -4
View File
@@ -24,7 +24,7 @@ v1.0:
☐ Document all exported types and functions
☐ Add JSDoc for public APIs
☐ Test coverage meets threshold
☐ Achieve 100% branch coverage on `src/primitive.ts`
☐ Achieve 100% branch coverage on `src/primitive-union.ts`
☐ Achieve 100% branch coverage on `src/index.ts`
Testing:
@@ -42,7 +42,7 @@ Testing:
☐ Type hole when using broad types like string as a universe @high
☐ handlers cannot be exhaustive, yet it is possible to not have a fallback
☐ one test even exploits this, I think for a negative test
☐ does the same type hole exist for tagged-union matchers or primitive matchers only?
☐ does the same type hole exist for tagged-union matchers or primitive-union matchers only?
Matcher:
✔ Clean up: adopt the 3-overload matcher (`src/prototype-ac2.ts`) and delete the prototypes @high @done
@@ -55,10 +55,11 @@ Matcher:
✔ Implement matcher with similar API like matcher from primitive.ts @high @done
→ `getTaggedUnionMatcher` / `getTaggedUnionMatcherW`, curried on the discriminant key
→ fallback is the second argument; `_` removed
☐ Rename `primitive` to `primitive-union` and `getMatcher` to `getPrimitiveMatcher` @medium
✔ Rename `primitive` to `primitive-union` and `getMatcher` to `getPrimitiveMatcher` @medium @done
→ `src/primitive.ts` / `src/primitive.test.ts` → `primitive-union.*`
→ `getMatcherW` → `getPrimitiveMatcherW` for symmetry with the tagged-union pair
→ update `src/index.ts`, `development/library.md` and any README references
→ shipped as `getPrimitiveUnionMatcher` / `getPrimitiveUnionMatcherW`; kept `Union` for symmetry with the tagged-union pair
☐ when using a union type as a property, the current behavior of tagged union matcher is
to pass never to handler parameters
→ new matcher function needed or can be fixed in tagged union matcher
@@ -72,7 +73,7 @@ Enhancements:
✔ Are there other primitive types that should be supported in union patterns? (e.g. `bigint`, `symbol`) @medium @done
→ added boolean, null and undefined; rejected `symbol` (compile-time brand, nothing at runtime) and `bigint` (not a property key)
☐ Allow boolean, null and undefined discriminant values in tagged-union patterns @medium
→ needs the primitive matcher's `PatternKey` / `PatternParam` projection; see development/library.md § Tagged-union matcher
→ needs the primitive-union matcher's `PatternKey` / `PatternParam` projection; see development/library.md § Tagged-union matcher
Documentation:
☐ Bring README.md back to its previous form — synopsis and examples restored, in the correct place