Back to Type Challenges

README

questions/01042-medium-isnever/README.md

latest2.3 KB
Original Source
<!--info-header-start--><h1>IsNever </h1><blockquote><p>by hiroya iizuka <a href="https://github.com/hiroyaiizuka" target="_blank">@hiroyaiizuka</a></p></blockquote><p><a href="https://tsch.js.org/1042/play" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.ko.md" target="_blank"></a> </p><!--info-header-end-->

Implement a type IsNever, which takes input type T. If the type of resolves to never, return true, otherwise false.

For example:

ts
type A = IsNever<never> // expected to be true
type B = IsNever<undefined> // expected to be false
type C = IsNever<null> // expected to be false
type D = IsNever<[]> // expected to be false
type E = IsNever<number> // expected to be false
<!--info-footer-start-->

<a href="../../README.md" target="_blank"></a> <a href="https://tsch.js.org/1042/answer" target="_blank"></a> <a href="https://tsch.js.org/1042/solutions" target="_blank"></a> <hr><h3>Related Challenges</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/01097-medium-isunion/README.md" target="_blank"></a> <a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00223-hard-isany/README.md" target="_blank"></a> <a href="https://github.com/type-challenges/type-challenges/blob/main/questions/04484-medium-istuple/README.md" target="_blank"></a> <!--info-footer-end-->