Back to Type Challenges

README.Zh CN

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

latest1.6 KB
Original Source
<!--info-header-start--><h1>联合类型转化为交叉类型 </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/zh-CN" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> </p><!--info-header-end-->

实现高级工具类型 UnionToIntersection<U>

例如

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

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