, Exclude<"a" | "b" | "c", "a">>>,
Expect 내장 exclude를 구현해보자./*
43 - Exclude
-------
by Zheeeng (@zheeeng) #easy #built-in
### Question
Implement the built-in Exclude<T, U>
> Exclude from T those types that are assignable to U
> View on GitHub: <https://tsch.js.org/43>
*/
/* _____________ Your Code Here _____________ */
type MyExclude<T, U> = any
/* _____________ Test Cases _____________ */
import { Equal, Expect, ExpectFalse, NotEqual } from '@type-challenges/utils'
type cases = [
Expect<Equal<MyExclude<"a" | "b" | "c", "a">, Exclude<"a" | "b" | "c", "a">>>,
Expect<Equal<MyExclude<"a" | "b" | "c", "a" | "b">, Exclude<"a" | "b" | "c", "a" | "b">>>,
Expect<Equal<MyExclude<string | number | (() => void), Function>, Exclude<string | number | (() => void), Function>>>,
]
/* _____________ Further Steps _____________ */
/*
> Share your solutions: <https://tsch.js.org/43/answer>
> View solutions: <https://tsch.js.org/43/solutions>
> More Challenges: <https://tsch.js.org>
*/
Exclude<T, U>
-- U
에 할당할 수 있는 타입은 T
에서 제외type MyExclude<T, U> = T extends U ? never : T