Back to Type Challenges

README

questions/00055-hard-union-to-intersection/README.md

latest1.5 KB
Original Source
<!--info-header-start--><h1>Union to Intersection </h1><blockquote><p>by Zheeeng <a href="https://github.com/zheeeng" target="_blank">@zheeeng</a></p></blockquote><p><a href="https://tsch.js.org/55/play" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> </p><!--info-header-end-->

Implement the advanced util type UnionToIntersection<U>

For example

ts
type I = UnionToIntersection<'foo' | 42 | true> // expected to be 'foo' & 42 & true
<!--info-footer-start-->

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