📝 Document the tagged-union matcher

This commit is contained in:
tmu committed 2026-09-21 22:14:22 +00:00
1 parent c0fc090ee4
commit 8ab3c6dbc6
3 files changed
+59 -3

No files matched your search

+5
View File
@@ -46,6 +46,9 @@ Matcher:
→ the fallback is now a second argument: `(handlers, (s) => …)`, `s: Exclude<T, keyof handlers>`
✔ A fallback for an already-exhaustive handler map must be a compile error @medium @done
→ rejected by an F-bounded constraint on `Handled` (checked *after* inference); a conditional in the fallback parameter is evaluated too early and breaks contextual typing
✔ 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
Bugs:
✔ TS 7 LSP server logs `context canceled` on stderr at shutdown @done
@@ -55,6 +58,8 @@ Enhancements:
✔ Allow boolean literals in primitive union patterns (e.g. `true: () => "yes"`) @medium @done
✔ 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
Documentation:
☐ Bring README.md back to its previous form — synopsis and examples restored, in the correct place