/** @public */ export type ActionFromMatcher> = M extends Matcher ? T : never; export type ActionsUnionType> = ReturnType; /** * returns True if TS version is above 3.5, False if below. * uses feature detection to detect TS version >= 3.5 * * versions below 3.5 will return `{}` for unresolvable interference * * versions above will return `unknown` * * @internal */ export type AtLeastTS35 = [True, False][IsUnknown() => T)>, 0, 1>]; /** @public */ export type DispatchFn any> = (...a: Parameters) => void; export type ExcludeFromTuple = T extends [ infer Head, ...infer Tail ] ? ExcludeFromTuple : Acc; export type FallbackIfUnknown = IsUnknown; export interface HasMatchFunction { match: TypeGuard; } export type Id = { [K in keyof T]: T[K]; } & {}; /** * @internal */ export type IfMaybeUndefined = [undefined] extends [P] ? True : False; /** * @internal */ export type IfVoid = [void] extends [P] ? True : False; /** * return True if T is `any`, otherwise return False * taken from https://github.com/joonhocho/tsdef * * @internal */ export type IsAny = true | false extends (T extends never ? true : false) ? True : False; /** * @internal */ export type IsEmptyObj = T extends any ? keyof T extends never ? IsUnknown>> : False : never; /** * return True if T is `unknown`, otherwise return False * taken from https://github.com/joonhocho/tsdef * * @internal */ export type IsUnknown = unknown extends T ? IsAny : False; /** * @internal */ export type IsUnknownOrNonInferrable = AtLeastTS35, IsEmptyObj>>; export type Matcher = HasMatchFunction | TypeGuard; /** * Helper type. Passes T out again, but boxes it in a way that it cannot * "widen" the type by accident if it is a generic that should be inferred * from elsewhere. * * @internal */ export type NoInfer = [T][T extends any ? 0 : never]; export type Omit = Pick>; export type ReplaceReturnType any, TNewReturn> = (...a: Parameters) => TNewReturn; export interface TypeGuard { (value: any): value is T; } /** * Convert a Union type `(A|B)` to an intersection type `(A&B)` */ export type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; export declare const hasMatchFunction: (v: Matcher) => v is HasMatchFunction;