This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Don't ask about this one. I have no idea what this magic is. | |
// Copied from https://github.com/microsoft/TypeScript/issues/13298#issuecomment-724542300. | |
type UnionToIntersection<U> = ( | |
U extends any ? (arg: U) => any : never | |
) extends (arg: infer I) => void | |
? I | |
: never; | |
// Continuation of above. | |
type UnionToTuple<T> = UnionToIntersection<(T extends any ? (t: T) => T : never)> extends (_: any) => infer W |