Back to Type Challenges

README

questions/03196-medium-flip-arguments/README.md

latest1.7 KB
Original Source
<!--info-header-start--><h1>Flip Arguments </h1><blockquote><p>by jiangshan <a href="https://github.com/jiangshanmeta" target="_blank">@jiangshanmeta</a></p></blockquote><p><a href="https://tsch.js.org/3196/play" target="_blank"></a> </p><!--info-header-end-->

Implement the type version of lodash's _.flip.

Type FlipArguments<T> requires function type T and returns a new function type which has the same return type of T but reversed parameters.

For example:

typescript
type Flipped = FlipArguments<(arg0: string, arg1: number, arg2: boolean) => void> 
// (arg0: boolean, arg1: number, arg2: string) => void
<!--info-footer-start-->

<a href="../../README.md" target="_blank"></a> <a href="https://tsch.js.org/3196/answer" target="_blank"></a> <a href="https://tsch.js.org/3196/solutions" target="_blank"></a> <hr><h3>Related Challenges</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/03192-medium-reverse/README.md" target="_blank"></a> <!--info-footer-end-->