import type { IsUnion } from './base'; export declare type AnyFunction = (...args: any[]) => any; export declare type AnyFunctionOfTake = A extends any[] ? (IsUnion extends true ? ((...args: [...A]) => any) : ((arg: A) => any)) : (arg: A) => any; export declare type AnyFunctionOfReturn = (...args: any[]) => T; export declare type Noop = (...args: any[]) => void; /** * @example * ``` * type Temp = (a: number, b: string) => string * type Temp2 = (...arg: string[]) => string * // Expect: 2 * type test1 = FunctionLength * // Expect: number * type test2 = FunctionLength * ``` */ export declare type FunctionLength = Target extends (...args: infer Parameters) => any ? Parameters['length'] : never; /** * Basic interface for guarded functions that use [predicates](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) * @see Usecase - {@link https://github.com/ts-essentials/ts-essentials#predicatetype} * @see Copyright - Get the idea from {@link https://github.com/ts-essentials/ts-essentials/blob/5aa1f264e77fb36bb3f673c49f00927c7c181a7f/lib/types.ts#L484} */ export interface PredicateFunction { (target: Target, ..._: unknown[]): target is Target; (target: any, ..._: unknown[]): target is Target; } /** * Extracts the [predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) of a guarded function * @see Usecase - {@link https://github.com/ts-essentials/ts-essentials#predicatetype} * @see Copyright - Get the idea from {@link https://github.com/ts-essentials/ts-essentials/blob/5aa1f264e77fb36bb3f673c49f00927c7c181a7f/lib/types.ts#L489} */ export declare type PredicateTypeOf = Predicator extends (target: unknown, ...rest: any[]) => target is infer P ? P : never; /** * @example * ``` * type Temp = (a: number, b: string) => string * // Expect: (a: number, b: string) => Promise * type test1 = FunctionPromisify * ``` */ export declare type FunctionPromisify = (...args: Parameters) => Promise>; //# sourceMappingURL=function.d.ts.map