ts challenges 43 #13619
ts challenges 43
#13619
-
type MyExclude<T, U> = T extends (U | infer A) ? A : never type test = MyExclude<'a', 'a'> why this "test" type is "a"? i think it should be "never" |
Beta Was this translation helpful? Give feedback.
Answered by
JonghwanWon
Jul 29, 2022
Replies: 1 comment
-
Hi @maskle
Hope this helps. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
maskle
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @maskle
T extends (U | infer A)
is alwaystrue
.T
inferred to beA
because(U | infer A)
is union.That is,
T
expandsT
. So it becomes true.Hope this helps.