Sunny-117 / js-challenges

✨✨✨ Challenge your JavaScript programming limits step by step

Home Page:https://juejin.cn/column/7244788137410560055

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

if

FailurMan opened this issue · comments

//如果是正确就返回第二个,如果错误则返回第三个
type If<U extends Boolean, K extends any , T extends any> = U extends true ? K : T
type A = If<true, 'a', 'b'>  // expected to be 'a'
type B = If<false, 'a', 'b'> // expected to be 'b'