Skip to content

Commit

Permalink
fix(match): cast to function properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ecyrbe committed Aug 1, 2023
1 parent f6c7c16 commit 9e0e25f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/internals/match/Match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ export namespace Match {
* ]>
* ```
*/
export type With<pattern, handler> = pattern extends Fn ? Impl.With<never, handler, pattern> : Impl.With<pattern, handler, PatternMatchFn>;
export type With<pattern, handler> = pattern extends infer MatchFn extends Fn ?
Impl.With<never, handler, MatchFn> :
Impl.With<pattern, handler, PatternMatchFn>;
/**
* Match.WithEqual matches exactly a type with a handler.
* The handler can be any Fn or value type.
Expand Down

0 comments on commit 9e0e25f

Please sign in to comment.