Back to Type Challenges

README.Ko

questions/00268-easy-if/README.ko.md

latest1.8 KB
Original Source
<!--info-header-start--><h1>If </h1><blockquote><p>by Pavel Glushkov <a href="https://github.com/pashutk" target="_blank">@pashutk</a></p></blockquote><p><a href="https://tsch.js.org/268/play/ko" target="_blank"></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"></a> <a href="./README.zh-CN.md" target="_blank"></a> <a href="./README.ja.md" target="_blank"></a> </p><!--info-header-end-->

조건 C, 참일 때 반환하는 타입 T, 거짓일 때 반환하는 타입 F를 받는 타입 If를 구현하세요. Ctrue 또는 false이고, TF는 아무 타입입니다.

예시:

ts
type A = If<true, 'a', 'b'>  // expected to be 'a'
type B = If<false, 'a', 'b'> // expected to be 'b'
<!--info-footer-start-->

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