Skip to content

Commit

Permalink
fix: base case should be never
Browse files Browse the repository at this point in the history
  • Loading branch information
andnp committed Mar 11, 2019
1 parent ebe9c2e commit fce8fa5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/types/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export type AnyFunc<R = any> = (...args: any[]) => R;
* @returns the function `F` with new return value `R`
*/
export type OverwriteReturn<F extends AnyFunc, R> =
F extends ((...x: infer T) => unknown) ? ((...x: T) => R) : AnyFunc<R>;
F extends ((...x: infer T) => unknown) ? ((...x: T) => R) : never;

/**
* Returns a tuple type of a functions arguments up to 7.
* @param F a function with up to 7 arguments
* @returns a tuple containing `F`'s argument types
*/
export type ArgsAsTuple<F extends AnyFunc> =
F extends ((...x: infer T) => unknown) ? T : any[];
F extends ((...x: infer T) => unknown) ? T : never;

0 comments on commit fce8fa5

Please sign in to comment.