Back to Type Challenges

README

questions/00043-easy-exclude/README.md

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

Implement the built-in Exclude<T, U>

Exclude from T those types that are assignable to U

For example:

ts
type Result = MyExclude<'a' | 'b' | 'c', 'a'> // 'b' | 'c'
<!--info-footer-start-->

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