📝 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:
1 parent
16904440cf
commit
1ad19ba308
3 files changed
+19
-22
No files matched your search
@@ -9,7 +9,7 @@ ordinary objects whose `matches` method is a TypeScript type guard, so narrowing
|
||||
composes the way any other guard does. It is deliberately not a regex engine and
|
||||
not a macro: there is no transpiler and no DSL to learn, and the type-level
|
||||
contract is the feature — see [development/library.md](./development/library.md)
|
||||
for the design decisions and the known limitations.
|
||||
for the design decisions and [Caveats](#caveats) for the limits.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -23,6 +23,18 @@ for the design decisions and the known limitations.
|
||||
|
||||
Yet to be implemented
|
||||
|
||||
## Caveats
|
||||
|
||||
- **A value and its stringification collide.** Object keys stringify, so a
|
||||
universe that mixes a member with the string it stringifies to — `1 | "1"`,
|
||||
`true | "true"`, `null | "null"` — collapses to a single handler key and both
|
||||
members are routed to it. Use one form or the other.
|
||||
- **`symbol` and `bigint` are not supported.** A `symbol` brand is a
|
||||
compile-time phantom with nothing to match at runtime, and a `bigint` is not a
|
||||
valid property key; neither satisfies the matcher's universe constraint.
|
||||
- **`NaN` and `-0` cannot be matched specifically.** They have no literal type,
|
||||
so both stay part of `number`.
|
||||
|
||||
## License
|
||||
|
||||
MIT © 2025 tmu. See [LICENSE](./LICENSE).
|
||||
|
||||
Reference in new issue
Block a user