Back to Type Challenges

README

questions/04179-medium-flip/README.md

latest1.3 KB
Original Source
<!--info-header-start--><h1>Flip </h1><blockquote><p>by Farhan Kathawala <a href="https://github.com/kathawala" target="_blank">@kathawala</a></p></blockquote><p><a href="https://tsch.js.org/4179/play" target="_blank"></a> </p><!--info-header-end-->

Implement the type of just-flip-object. Examples:

typescript
Flip<{ a: "x", b: "y", c: "z" }>; // {x: 'a', y: 'b', z: 'c'}
Flip<{ a: 1, b: 2, c: 3 }>; // {1: 'a', 2: 'b', 3: 'c'}
Flip<{ a: false, b: true }>; // {false: 'a', true: 'b'}

No need to support nested objects and values which cannot be object keys such as arrays

<!--info-footer-start-->

<a href="../../README.md" target="_blank"></a> <a href="https://tsch.js.org/4179/answer" target="_blank"></a> <a href="https://tsch.js.org/4179/solutions" target="_blank"></a> <!--info-footer-end-->