<
R,
const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>,
Ret,
Fn extends (_: Types.NotMatch<R, P>) => Ret
>(
pattern: P,
f: Fn
): <I, F, A, Pr>(
self: Matcher<I, F, R, A, Pr, Ret>
) => Matcher<
I,
Types.AddOnly<F, Types.WhenMatch<R, P>>,
Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>,
A | ReturnType<Fn>,
Pr,
Ret
>Creates a pattern that excludes a specific value while allowing all others.
When to use
Use to add a negative pattern case for inputs that should match when another pattern does not.
Details
Any excluded value bypasses the provided function and continues matching through later cases.
Example (Ignoring a specific value)
import { Match } from "effect"
// Create a matcher for string or number values
const match = Match.type<string | number>().pipe(
// Match any value except "hi", returning "ok"
Match.not("hi", () => "ok"),
// Fallback case for when the value is "hi"
Match.orElse(() => "fallback")
)
console.log(match("hello"))
// Output: "ok"
console.log(match("hi"))
// Output: "fallback"export const const not: <
R,
P extends
| Types.PatternPrimitive<R>
| Types.PatternBase<R>,
Ret,
Fn extends (_: Types.NotMatch<R, P>) => Ret
>(
pattern: P,
f: Fn
) => <I, F, A, Pr>(
self: Matcher<I, F, R, A, Pr, Ret>
) => Matcher<
I,
Types.AddOnly<F, Types.WhenMatch<R, P>>,
Types.ApplyFilters<
I,
Types.AddOnly<F, Types.WhenMatch<R, P>>
>,
A | ReturnType<Fn>,
Pr,
Ret
>
Creates a pattern that excludes a specific value while allowing all others.
When to use
Use to add a negative pattern case for inputs that should match when another
pattern does not.
Details
Any excluded value bypasses the provided function and continues matching
through later cases.
Example (Ignoring a specific value)
import { Match } from "effect"
// Create a matcher for string or number values
const match = Match.type<string | number>().pipe(
// Match any value except "hi", returning "ok"
Match.not("hi", () => "ok"),
// Fallback case for when the value is "hi"
Match.orElse(() => "fallback")
)
console.log(match("hello"))
// Output: "ok"
console.log(match("hi"))
// Output: "fallback"
not: <
function (type parameter) R in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>R,
const function (type parameter) P in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>P extends Types.type Types.PatternPrimitive<A> = A | Types.PredicateA<A> | SafeRefinement<any, any>Defines primitive patterns that can match simple values.
Details
This type represents the building blocks of pattern matching: predicates,
literal values, and safe refinements. These are the atomic patterns that
can be composed into more complex matching logic.
PatternPrimitive<function (type parameter) R in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>R> | Types.type Types.PatternBase<A> = A extends readonly (infer _T)[] ? readonly any[] | Types.PatternPrimitive<A> : A extends Record<string, any> ? Partial<{ [K in keyof A]: Types.PatternPrimitive<A[K] & {}> | Types.PatternBase<A[K] & {}>; }> : neverDefines the structure for complex object and array patterns.
Details
This type represents patterns that can match against complex data structures
like objects and arrays. It supports nested pattern matching and partial
object matching, enabling sophisticated pattern compositions.
Example (Describing complex object patterns)
import { Match } from "effect"
// PatternBase enables complex object patterns
type UserPattern = Match.Types.PatternBase<{
name: string
age: number
role: "admin" | "user"
}>
// Allows: { name?: string | Predicate, age?: number | Predicate, ... }
// Example usage:
Match.value({ name: "Alice", age: 30, role: "admin" as const }).pipe(
Match.when(
{ age: (n: number) => n >= 18, role: "admin" },
(user: { name: string; age: number; role: "admin" }) =>
`Admin: ${user.name}`
),
Match.orElse(() => "Not an adult admin")
)
PatternBase<function (type parameter) R in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>R>,
function (type parameter) Ret in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Ret,
function (type parameter) Fn in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Fn extends (_: Exclude<
R,
Types.ExtractMatch<R, Types.PForNotMatch<P>>
>
_: Types.type Types.NotMatch<R, P> = R extends Types.ExtractMatch<R, Types.PForNotMatch<P>> ? never : RComputes the remaining type when a pattern P is excluded from type R.
Details
This utility type determines what type remains after a Match.not pattern
excludes certain values. It's the complement of WhenMatch, calculating
what's left after removing the matched portion.
Example (Computing unmatched types)
import type { Match } from "effect"
// NotMatch computes what remains after exclusion
type NotString = Match.Types.NotMatch<
string | number | boolean,
typeof Match.string
>
// Result: number | boolean
type NotSpecificValue = Match.Types.NotMatch<"a" | "b" | "c", "a">
// Result: "b" | "c"
NotMatch<function (type parameter) R in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>R, function (type parameter) P in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>P>) => function (type parameter) Ret in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Ret
>(
pattern: const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>pattern: function (type parameter) P in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>P,
f: Fn extends (_: Types.NotMatch<R, P>) => Retf: function (type parameter) Fn in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Fn
) => <function (type parameter) I in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>I, function (type parameter) F in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>F, function (type parameter) A in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>A, function (type parameter) Pr in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Pr>(
self: Matcher<I, F, R, A, Pr, Ret>self: type Matcher<
Input,
Filters,
RemainingApplied,
Result,
Provided,
Return = any
> =
| TypeMatcher<
Input,
Filters,
RemainingApplied,
Result,
Return
>
| ValueMatcher<
Input,
Filters,
RemainingApplied,
Result,
Provided,
Return
>
Union type for matchers created by Match.type and Match.value.
Details
A Matcher carries the input type, accumulated filters, remaining cases,
result type, and, for value matchers, the provided value being matched.
Example (Matching string and number values)
import { Match } from "effect"
// Simulated dynamic input that can be a string or a number
const input: string | number = "some input"
// ┌─── string
// ▼
const result = Match.value(input).pipe(
// Match if the value is a number
Match.when(Match.number, (n) => `number: ${n}`),
// Match if the value is a string
Match.when(Match.string, (s) => `string: ${s}`),
// Ensure all possible cases are covered
Match.exhaustive
)
console.log(result)
// Output: "string: some input"
Matcher<function (type parameter) I in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>I, function (type parameter) F in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>F, function (type parameter) R in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>R, function (type parameter) A in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>A, function (type parameter) Pr in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Pr, function (type parameter) Ret in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Ret>
) => type Matcher<
Input,
Filters,
RemainingApplied,
Result,
Provided,
Return = any
> =
| TypeMatcher<
Input,
Filters,
RemainingApplied,
Result,
Return
>
| ValueMatcher<
Input,
Filters,
RemainingApplied,
Result,
Provided,
Return
>
Union type for matchers created by Match.type and Match.value.
Details
A Matcher carries the input type, accumulated filters, remaining cases,
result type, and, for value matchers, the provided value being matched.
Example (Matching string and number values)
import { Match } from "effect"
// Simulated dynamic input that can be a string or a number
const input: string | number = "some input"
// ┌─── string
// ▼
const result = Match.value(input).pipe(
// Match if the value is a number
Match.when(Match.number, (n) => `number: ${n}`),
// Match if the value is a string
Match.when(Match.string, (s) => `string: ${s}`),
// Ensure all possible cases are covered
Match.exhaustive
)
console.log(result)
// Output: "string: some input"
Matcher<
function (type parameter) I in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>I,
Types.type Types.AddOnly<A, X> = [A] extends [Types.Without<infer WX>] ? [X] extends [WX] ? never : Types.Only<X> : [A] extends [Types.Only<infer OX>] ? [X] extends [OX] ? Types.Only<X> : never : neverAdds a type to the inclusion filter, refining what should be included.
Details
This utility type manages the refinement of included types during
pattern matching. It ensures that only the most specific type
constraints are maintained when multiple positive matches are applied.
Example (Refining included types)
import { Match } from "effect"
// AddOnly is used when refining positive matches:
Match.type<{ type: "user" | "admin"; name: string }>().pipe(
Match.when({ type: "admin" }, (admin) => admin.name),
// Type system uses AddOnly to refine the constraint
Match.orElse(() => "not admin")
)
AddOnly<function (type parameter) F in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>F, Types.type Types.WhenMatch<R, P> = [0] extends [1 & R] ? Types.ResolvePred<P, any> : P extends SafeRefinement<infer SP, never> ? SP : P extends Predicate.Refinement<infer _R, infer RP extends infer _R> ? [Extract<R, RP>] extends [infer X] ? [X] extends [never] ? RP : X : never : P extends Types.PredicateA<infer PP> ? PP : Types.ExtractMatch<R, P>Computes the matched type when a pattern P is applied to type R.
Details
This utility type determines what type a value will have after successfully
matching against a pattern. It handles refinements, predicates, and complex
object patterns to provide accurate type narrowing.
Example (Computing matched types)
import type { Match } from "effect"
// WhenMatch computes the narrowed type after pattern matching
type StringMatch = Match.Types.WhenMatch<string | number, typeof Match.string>
// Result: string
type ObjectMatch = Match.Types.WhenMatch<
{ type: "user"; name: string } | {
type: "admin"
permissions: Array<string>
},
{ type: "user" }
>
// Result: { type: "user"; name: string }
WhenMatch<function (type parameter) R in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>R, function (type parameter) P in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>P>>,
Types.type Types.ApplyFilters<I, A> = A extends Types.Only<infer X> ? X : A extends Types.Without<infer X> ? Exclude<I, X> : neverApplies accumulated filters to an input type, producing the final narrowed type.
Details
This utility type takes the collected inclusion/exclusion filters and
applies them to the input type to compute the final narrowed result.
It's the culmination of the type-level filtering process.
Example (Applying accumulated filters)
import type { Match } from "effect"
// ApplyFilters computes the final narrowed type:
type Result = Match.Types.ApplyFilters<
string | number | boolean,
Match.Types.Only<string>
>
// Result: string
type ExclusionResult = Match.Types.ApplyFilters<
string | number | boolean,
Match.Types.Without<string>
>
// Result: number | boolean
ApplyFilters<function (type parameter) I in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>I, Types.type Types.AddOnly<A, X> = [A] extends [Types.Without<infer WX>] ? [X] extends [WX] ? never : Types.Only<X> : [A] extends [Types.Only<infer OX>] ? [X] extends [OX] ? Types.Only<X> : never : neverAdds a type to the inclusion filter, refining what should be included.
Details
This utility type manages the refinement of included types during
pattern matching. It ensures that only the most specific type
constraints are maintained when multiple positive matches are applied.
Example (Refining included types)
import { Match } from "effect"
// AddOnly is used when refining positive matches:
Match.type<{ type: "user" | "admin"; name: string }>().pipe(
Match.when({ type: "admin" }, (admin) => admin.name),
// Type system uses AddOnly to refine the constraint
Match.orElse(() => "not admin")
)
AddOnly<function (type parameter) F in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>F, Types.type Types.WhenMatch<R, P> = [0] extends [1 & R] ? Types.ResolvePred<P, any> : P extends SafeRefinement<infer SP, never> ? SP : P extends Predicate.Refinement<infer _R, infer RP extends infer _R> ? [Extract<R, RP>] extends [infer X] ? [X] extends [never] ? RP : X : never : P extends Types.PredicateA<infer PP> ? PP : Types.ExtractMatch<R, P>Computes the matched type when a pattern P is applied to type R.
Details
This utility type determines what type a value will have after successfully
matching against a pattern. It handles refinements, predicates, and complex
object patterns to provide accurate type narrowing.
Example (Computing matched types)
import type { Match } from "effect"
// WhenMatch computes the narrowed type after pattern matching
type StringMatch = Match.Types.WhenMatch<string | number, typeof Match.string>
// Result: string
type ObjectMatch = Match.Types.WhenMatch<
{ type: "user"; name: string } | {
type: "admin"
permissions: Array<string>
},
{ type: "user" }
>
// Result: { type: "user"; name: string }
WhenMatch<function (type parameter) R in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>R, function (type parameter) P in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>P>>>,
function (type parameter) A in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>A | type ReturnType<
T extends (...args: any) => any
> = T extends (...args: any) => infer R ? R : any
Obtain the return type of a function type
ReturnType<function (type parameter) Fn in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Fn>,
function (type parameter) Pr in <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>): Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Pr,
function (type parameter) Ret in <R, const P extends Types.PatternPrimitive<R> | Types.PatternBase<R>, Ret, Fn extends (_: Types.NotMatch<R, P>) => Ret>(pattern: P, f: Fn): <I, F, A, Pr>(self: Matcher<I, F, R, A, Pr, Ret>) => Matcher<I, Types.AddOnly<F, Types.WhenMatch<R, P>>, Types.ApplyFilters<I, Types.AddOnly<F, Types.WhenMatch<R, P>>>, A | ReturnType<Fn>, Pr, Ret>Ret
> = import internalinternal.const not: <
R,
P extends
| Types.PatternPrimitive<R>
| Types.PatternBase<R>,
Ret,
Fn extends (_: Types.NotMatch<R, P>) => Ret
>(
pattern: P,
f: Fn
) => <I, F, A, Pr>(
self: Matcher<I, F, R, A, Pr, Ret>
) => Matcher<
I,
Types.AddOnly<F, Types.WhenMatch<R, P>>,
Types.ApplyFilters<
I,
Types.AddOnly<F, Types.WhenMatch<R, P>>
>,
A | ReturnType<Fn>,
Pr,
Ret
>
not