♻️ Keep the public API to the four factories

The builder types are already the inferred return types and travel into
the emitted .d.ts, so exporting them only made them nameable while
pinning the internal Strict/Widening split as API. Revert the type
exports and the public renames, drop the type-surface test, and document
only the factories in README and development/library.md.
This commit is contained in:
tmu committed 2026-09-23 22:19:02 +00:00
1 parent 9c9468fa3c
commit 5ddbbdc183
7 files changed
+37 -145

No files matched your search

+10 -10
View File
@@ -21,17 +21,17 @@ for the design decisions and [Caveats](#caveats) for the limits.
## API
The package exports four factories and the builder types they return. Each
factory comes in a _strict_ variant (one common return type `R`) and a
_widening_ variant: the `W` suffix means **widening** — the return value is
widened from one common `R` to the union of every handler's return type.
The package exports four factories. Each comes in a _strict_ variant (one common
return type `R`) and a _widening_ variant: the `W` suffix means **widening** —
the return value is widened from one common `R` to the union of every handler's
return type.
| Factory | Builder type | Return of the matcher |
| -------------------------------- | ------------------------------- | -------------------------------- |
| `getPrimitiveUnionMatcher<T>()` | `PrimitiveUnionMatcher<T>` | one common `R` |
| `getPrimitiveUnionMatcherW<T>()` | `PrimitiveUnionMatcherW<T>` | the union of the handler returns |
| `getTaggedUnionMatcher<T>()` | `TaggedUnionMatcherFactory<T>` | one common `R` |
| `getTaggedUnionMatcherW<T>()` | `TaggedUnionMatcherWFactory<T>` | the union of the handler returns |
| Factory | Return of the matcher |
| -------------------------------- | -------------------------------- |
| `getPrimitiveUnionMatcher<T>()` | one common `R` |
| `getPrimitiveUnionMatcherW<T>()` | the union of the handler returns |
| `getTaggedUnionMatcher<T>()` | one common `R` |
| `getTaggedUnionMatcherW<T>()` | the union of the handler returns |
### Primitive-union matchers