📝 Document matcher caveats in the README

State the end-user limits once, in README § Caveats: a member colliding
with its stringification, the unsupported symbol/bigint, and NaN/-0. Drop
the duplicated known-issue prose from development/library.md and the
source comment; link to the README instead.
This commit is contained in:
tmu committed 2026-09-21 10:33:36 +00:00
1 parent 16904440cf
commit 1ad19ba308
3 files changed
+19 -22

No files matched your search

+2 -5
View File
@@ -3,16 +3,13 @@ import type { Exact, ValueOf } from "type-fest";
type UnaryFn<T, R> = (shape: T) => R;
// The primitive universe a matcher can discriminate. `boolean` is admitted as
// the pair `true | false`; `symbol` is deliberately absent (a brand is a
// compile-time phantom, so there is nothing to match at runtime).
// the pair `true | false`; see README § Caveats for the unsupported members.
type Matchable = string | number | boolean | null | undefined;
// `boolean`, `null` and `undefined` cannot be property keys, so a mapped type
// over the universe keys each non-key member by its stringification. `Param`
// inverts that projection, so a handler callback still receives the *real*
// member (`true`, not `"true"`). A universe mixing a member with the string it
// stringifies to (e.g. `true | "true"`) collapses to one key and is not
// representable — see development/library.md.
// member (`true`, not `"true"`) — see README § Caveats for the limits.
type PatternKey<T> = T extends boolean
? T extends true
? "true"