Skip to content

Commit

Permalink
make isAnyOf friendly for mapped matchers, but making argument optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Pimenov authored and Alex Pimenov committed Jan 26, 2023
1 parent d2d0f70 commit 5b11ec3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/toolkit/src/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import type {

/** @public */
export type ActionMatchingAnyOf<
Matchers extends [Matcher<any>, ...Matcher<any>[]]
Matchers extends [...Matcher<any>[]]
> = ActionFromMatcher<Matchers[number]>

/** @public */
export type ActionMatchingAllOf<
Matchers extends [Matcher<any>, ...Matcher<any>[]]
Matchers extends [...Matcher<any>[]]
> = UnionToIntersection<ActionMatchingAnyOf<Matchers>>

const matches = (matcher: Matcher<any>, action: any) => {
Expand All @@ -38,7 +38,7 @@ const matches = (matcher: Matcher<any>, action: any) => {
*
* @public
*/
export function isAnyOf<Matchers extends [Matcher<any>, ...Matcher<any>[]]>(
export function isAnyOf<Matchers extends [...Matcher<any>[]]>(
...matchers: Matchers
) {
return (action: any): action is ActionMatchingAnyOf<Matchers> => {
Expand All @@ -55,7 +55,7 @@ export function isAnyOf<Matchers extends [Matcher<any>, ...Matcher<any>[]]>(
*
* @public
*/
export function isAllOf<Matchers extends [Matcher<any>, ...Matcher<any>[]]>(
export function isAllOf<Matchers extends [...Matcher<any>[]]>(
...matchers: Matchers
) {
return (action: any): action is ActionMatchingAllOf<Matchers> => {
Expand Down

0 comments on commit 5b11ec3

Please sign in to comment.