We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Exclude
1 parent 7f1f421 commit 2e3297eCopy full SHA for 2e3297e
src/base.ts
@@ -17,12 +17,13 @@ type LastInUnion<U> = U2I<
17
? L
18
: never
19
20
+type U2T_Exclude<T,U> = T extends U ? (<A>() => (A extends T ? 1 : 2)) extends (<A>() => (A extends U ? 1 : 2)) ? never : T : T
21
/**
22
* U2T<1 | 2> = [1, 2].
23
*/
24
export type U2T<U, Last = LastInUnion<U>> = [U] extends [never]
25
? []
- : [...U2T<Exclude<U, Last>>, Last]
26
+ : [...U2T<U2T_Exclude<U, Last>>, Last]
27
28
type IsUnion<T, U = T> = T extends U ? ([U] extends [T] ? false : true) : false
29
0 commit comments