Type Challenges Judge

If

提出詳細

type If<T extends boolean, U, K> = T extends true ? U : K
提出日時2025-02-08 00:21:30
問題If
ユーザーt-fukatsu
ステータスAccepted
テストケース
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<If<true, 'a', 'b'>, 'a'>>, Expect<Equal<If<false, 'a', 2>, 2>>, ] // @ts-expect-error type error = If<null, 'a', 'b'>