♻️ Align primitive-union matcher names and drop stale lint disables

Rename `MatcherStrict` / `MatcherWidening` to
`PrimitiveUnionMatcherStrict` / `PrimitiveUnionMatcherWidening`, matching
the exported `getPrimitiveUnionMatcher(W)` names and the
`TaggedUnionMatcher*` pair.

Folds in the working-tree lint cleanups: drop the now-unneeded
`typescript/unified-signatures` disables and turn the tagged-union
factory interfaces into type aliases.
This commit is contained in:
tmu committed 2026-09-22 11:05:16 +00:00
1 parent 09e1c12270
commit 4ebe18adb1
2 files changed
+12 -14

No files matched your search

+4 -8
View File
@@ -40,11 +40,10 @@ type MustBePartial<T extends Matchable, Handled> =
// so `Exact` restores it for the generic forms: a handler map can otherwise
// carry keys outside `T`.
// oxlint-disable typescript/unified-signatures
// Strict returns: one common `R`. Overload order is load-bearing:
// #1 Handlers (first) -> the exhaustive form and the autocomplete popup
// #2 Fallback (last) -> accepts a partial handler map plus a fallback
interface MatcherStrict<T extends Matchable> {
interface PrimitiveUnionMatcherStrict<T extends Matchable> {
<R>(handlers: Handlers<T, R>): UnaryFn<T, R>;
<
R,
@@ -55,13 +54,11 @@ interface MatcherStrict<T extends Matchable> {
fallback: Fallback<T, Handled, R>,
): UnaryFn<T, R>;
}
// oxlint-enable typescript/unified-signatures
// Widened returns: the union of every handler's return type. `P` is inferred
// from the whole handler map, whose closed constraint supplies the
// contextual/autocomplete type.
// oxlint-disable typescript/unified-signatures
interface MatcherWidening<T extends Matchable> {
interface PrimitiveUnionMatcherWidening<T extends Matchable> {
<P extends Exact<Handlers<T, unknown>, P>>(
handlers: P,
): UnaryFn<T, PatternReturns<P>>;
@@ -74,7 +71,6 @@ interface MatcherWidening<T extends Matchable> {
fallback: Fallback<T, Handled, R>,
): UnaryFn<T, PatternReturns<Handled> | R>;
}
// oxlint-enable typescript/unified-signatures
const dispatch =
(handlers: HandlerMap, fallback?: UnaryFn<never, unknown>) =>
@@ -101,7 +97,7 @@ const dispatch =
export const getPrimitiveUnionMatcher = <
T extends Matchable,
>(): MatcherStrict<T> => dispatch;
>(): PrimitiveUnionMatcherStrict<T> => dispatch;
export const getPrimitiveUnionMatcherW = <
T extends Matchable,
>(): MatcherWidening<T> => dispatch;
>(): PrimitiveUnionMatcherWidening<T> => dispatch;