7. implement Exclude<T, E>
Share
- accepted / - tried
Exclude<T, K>
returns a type by removing from T the union members that are assignable to K.
Please implement MyExclude<T, K>
by yourself.
type Foo = 'a' | 'b' | 'c'type A = MyExclude<Foo, 'a'> // 'b' | 'c'type B = MyExclude<Foo, 'c'> // 'a' | 'btype C = MyExclude<Foo, 'c' | 'd'> // 'a' | 'b'type D = MyExclude<Foo, 'a' | 'b' | 'c'> // never