diff --git a/src/primitive-union.ts b/src/primitive-union.ts index bebc727..7c6061b 100644 --- a/src/primitive-union.ts +++ b/src/primitive-union.ts @@ -40,11 +40,10 @@ type MustBePartial = // 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 { +interface PrimitiveUnionMatcherStrict { (handlers: Handlers): UnaryFn; < R, @@ -55,13 +54,11 @@ interface MatcherStrict { fallback: Fallback, ): UnaryFn; } -// 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 { +interface PrimitiveUnionMatcherWidening {

, P>>( handlers: P, ): UnaryFn>; @@ -74,7 +71,6 @@ interface MatcherWidening { fallback: Fallback, ): UnaryFn | R>; } -// oxlint-enable typescript/unified-signatures const dispatch = (handlers: HandlerMap, fallback?: UnaryFn) => @@ -101,7 +97,7 @@ const dispatch = export const getPrimitiveUnionMatcher = < T extends Matchable, ->(): MatcherStrict => dispatch; +>(): PrimitiveUnionMatcherStrict => dispatch; export const getPrimitiveUnionMatcherW = < T extends Matchable, ->(): MatcherWidening => dispatch; +>(): PrimitiveUnionMatcherWidening => dispatch; diff --git a/src/tagged-union.ts b/src/tagged-union.ts index 69aa65b..f501cc3 100644 --- a/src/tagged-union.ts +++ b/src/tagged-union.ts @@ -102,13 +102,15 @@ interface TaggedUnionMatcherWidening { // The key-taking step of the curried factory. Naming it lets the factory return // `dispatch` directly, the tacit twin of the primitive-union factory's bare // `=> dispatch`. -interface TaggedUnionMatcherFactory { - >(k: K): TaggedUnionMatcherStrict; -} +type TaggedUnionMatcherFactory = >( + k: K, +) => TaggedUnionMatcherStrict; -interface TaggedUnionMatcherWideningFactory { - >(k: K): TaggedUnionMatcherWidening; -} +type TaggedUnionMatcherWideningFactory = < + K extends Discriminated, +>( + k: K, +) => TaggedUnionMatcherWidening; const dispatch = (k: PropertyKey) =>