From a88d49ffe29df228d1a8ac1ba2ede092ef8b2757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 22 Sep 2026 09:47:05 +0000 Subject: [PATCH] :memo: Check off the primitive-union rename --- backlog.tasks | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backlog.tasks b/backlog.tasks index 9c1cc19..0d80323 100644 --- a/backlog.tasks +++ b/backlog.tasks @@ -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