@effect/match
Advanced tools
Comparing version 0.24.3 to 0.24.4
@@ -81,3 +81,3 @@ /** | ||
*/ | ||
export declare const when: <R, const P extends PatternPrimitive<R> | PatternBase<R>, B>(pattern: P, f: (_: WhenMatch<R, P>) => B) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddWithout<F, SafeSchemaR<PredToSchema<P>>>, ApplyFilters<I, AddWithout<F, SafeSchemaR<PredToSchema<P>>>>, B | A, Pr>; | ||
export declare const when: <R, const P extends PatternPrimitive<R> | PatternBase<R>, Fn extends (_: WhenMatch<R, P>) => unknown>(pattern: P, f: Fn) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddWithout<F, SafeSchemaR<PredToSchema<P>>>, ApplyFilters<I, AddWithout<F, SafeSchemaR<PredToSchema<P>>>>, A | ReturnType<Fn>, Pr>; | ||
/** | ||
@@ -89,3 +89,3 @@ * @category combinators | ||
*/ | ||
export declare const whenOr: <R, const P extends readonly (PatternPrimitive<R> | PatternBase<R>)[], B>(...args: [...patterns: P, f: (_: WhenMatch<R, P[number]>) => B]) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddWithout<F, SafeSchemaR<PredToSchema<P[number]>>>, ApplyFilters<I, AddWithout<F, SafeSchemaR<PredToSchema<P[number]>>>>, B | A, Pr>; | ||
export declare const whenOr: <R, const P extends readonly (PatternPrimitive<R> | PatternBase<R>)[], Fn extends (_: WhenMatch<R, P[number]>) => unknown>(...args: [...patterns: P, f: Fn]) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddWithout<F, SafeSchemaR<PredToSchema<P[number]>>>, ApplyFilters<I, AddWithout<F, SafeSchemaR<PredToSchema<P[number]>>>>, A | ReturnType<Fn>, Pr>; | ||
/** | ||
@@ -97,3 +97,3 @@ * @category combinators | ||
*/ | ||
export declare const whenAnd: <R, const P extends readonly (PatternPrimitive<R> | PatternBase<R>)[], B>(...args: [...patterns: P, f: (_: WhenMatch<R, UnionToIntersection<P[number]>>) => B]) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddWithout<F, SafeSchemaR<PredToSchema<UnionToIntersection<P[number]>>>>, ApplyFilters<I, AddWithout<F, SafeSchemaR<PredToSchema<UnionToIntersection<P[number]>>>>>, B | A, Pr>; | ||
export declare const whenAnd: <R, const P extends readonly (PatternPrimitive<R> | PatternBase<R>)[], Fn extends (_: WhenMatch<R, UnionToIntersection<P[number]>>) => unknown>(...args: [...patterns: P, f: Fn]) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddWithout<F, SafeSchemaR<PredToSchema<UnionToIntersection<P[number]>>>>, ApplyFilters<I, AddWithout<F, SafeSchemaR<PredToSchema<UnionToIntersection<P[number]>>>>>, A | ReturnType<Fn>, Pr>; | ||
/** | ||
@@ -143,3 +143,3 @@ * @category combinators | ||
*/ | ||
export declare const not: <R, const P extends PatternPrimitive<R> | PatternBase<R>, B>(pattern: P, f: (_: Exclude<R, ExtractMatch<R, SafeSchemaR<PredToSchema<P>>>>) => B) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddOnly<F, WhenMatch<R, P>>, ApplyFilters<I, AddOnly<F, WhenMatch<R, P>>>, B | A, Pr>; | ||
export declare const not: <R, const P extends PatternPrimitive<R> | PatternBase<R>, Fn extends (_: Exclude<R, ExtractMatch<R, SafeSchemaR<PredToSchema<P>>>>) => unknown>(pattern: P, f: Fn) => <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr>) => Matcher<I, AddOnly<F, WhenMatch<R, P>>, ApplyFilters<I, AddOnly<F, WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr>; | ||
/** | ||
@@ -339,3 +339,5 @@ * @since 1.0.0 | ||
export declare const exhaustive: <I, F, A, Pr>(self: Matcher<I, F, never, A, Pr>) => [Pr] extends [never] ? (u: I) => Unify<A> : Unify<A>; | ||
type WhenMatch<R, P> = 0 extends 1 & R ? PForMatch<P> : P extends SafeSchema<infer SP, never> ? SP : P extends Refinement<infer _R, infer RP> ? [ | ||
type WhenMatch<R, P> = [ | ||
0 | ||
] extends [1 & R] ? PForMatch<P> : P extends SafeSchema<infer SP, never> ? SP : P extends Refinement<infer _R, infer RP> ? [ | ||
Extract<R, RP> | ||
@@ -342,0 +344,0 @@ ] extends [infer X] ? [X] extends [never] ? RP : X : never : P extends PredicateA<infer PP> ? PP : ExtractMatch<R, PForMatch<P>>; |
{ | ||
"name": "@effect/match", | ||
"version": "0.24.3", | ||
"version": "0.24.4", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -220,5 +220,9 @@ /** | ||
export const when = | ||
<R, const P extends PatternPrimitive<R> | PatternBase<R>, B>( | ||
< | ||
R, | ||
const P extends PatternPrimitive<R> | PatternBase<R>, | ||
Fn extends (_: WhenMatch<R, P>) => unknown, | ||
>( | ||
pattern: P, | ||
f: (_: WhenMatch<R, P>) => B, | ||
f: Fn, | ||
) => | ||
@@ -231,3 +235,3 @@ <I, F, A, Pr>( | ||
ApplyFilters<I, AddWithout<F, PForExclude<P>>>, | ||
A | B, | ||
A | ReturnType<Fn>, | ||
Pr | ||
@@ -243,4 +247,8 @@ > => | ||
export const whenOr = | ||
<R, const P extends ReadonlyArray<PatternPrimitive<R> | PatternBase<R>>, B>( | ||
...args: [...patterns: P, f: (_: WhenMatch<R, P[number]>) => B] | ||
< | ||
R, | ||
const P extends ReadonlyArray<PatternPrimitive<R> | PatternBase<R>>, | ||
Fn extends (_: WhenMatch<R, P[number]>) => unknown, | ||
>( | ||
...args: [...patterns: P, f: Fn] | ||
) => | ||
@@ -253,3 +261,3 @@ <I, F, A, Pr>( | ||
ApplyFilters<I, AddWithout<F, PForExclude<P[number]>>>, | ||
A | B, | ||
A | ReturnType<Fn>, | ||
Pr | ||
@@ -268,4 +276,8 @@ > => { | ||
export const whenAnd = | ||
<R, const P extends ReadonlyArray<PatternPrimitive<R> | PatternBase<R>>, B>( | ||
...args: [...patterns: P, f: (_: WhenMatch<R, ArrayToIntersection<P>>) => B] | ||
< | ||
R, | ||
const P extends ReadonlyArray<PatternPrimitive<R> | PatternBase<R>>, | ||
Fn extends (_: WhenMatch<R, ArrayToIntersection<P>>) => unknown, | ||
>( | ||
...args: [...patterns: P, f: Fn] | ||
) => | ||
@@ -278,3 +290,3 @@ <I, F, A, Pr>( | ||
ApplyFilters<I, AddWithout<F, PForExclude<ArrayToIntersection<P>>>>, | ||
A | B, | ||
A | ReturnType<Fn>, | ||
Pr | ||
@@ -412,5 +424,9 @@ > => { | ||
export const not = | ||
<R, const P extends PatternPrimitive<R> | PatternBase<R>, B>( | ||
< | ||
R, | ||
const P extends PatternPrimitive<R> | PatternBase<R>, | ||
Fn extends (_: NotMatch<R, P>) => unknown, | ||
>( | ||
pattern: P, | ||
f: (_: NotMatch<R, P>) => B, | ||
f: Fn, | ||
) => | ||
@@ -423,3 +439,3 @@ <I, F, A, Pr>( | ||
ApplyFilters<I, AddOnly<F, WhenMatch<R, P>>>, | ||
A | B, | ||
A | ReturnType<Fn>, | ||
Pr | ||
@@ -738,3 +754,3 @@ > => | ||
// check for any | ||
0 extends 1 & R | ||
[0] extends [1 & R] | ||
? PForMatch<P> | ||
@@ -741,0 +757,0 @@ : P extends SafeSchema<infer SP, never> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139236
2821