We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ebe9c2e commit fce8fa5Copy full SHA for fce8fa5
src/types/functions.ts
@@ -22,12 +22,12 @@ export type AnyFunc<R = any> = (...args: any[]) => R;
22
* @returns the function `F` with new return value `R`
23
*/
24
export type OverwriteReturn<F extends AnyFunc, R> =
25
- F extends ((...x: infer T) => unknown) ? ((...x: T) => R) : AnyFunc<R>;
+ F extends ((...x: infer T) => unknown) ? ((...x: T) => R) : never;
26
27
/**
28
* Returns a tuple type of a functions arguments up to 7.
29
* @param F a function with up to 7 arguments
30
* @returns a tuple containing `F`'s argument types
31
32
export type ArgsAsTuple<F extends AnyFunc> =
33
- F extends ((...x: infer T) => unknown) ? T : any[];
+ F extends ((...x: infer T) => unknown) ? T : never;
0 commit comments