Convert a union to an overloaded function and extract tuple form. Note: this is an established trick but can be slow for very large unions.
type U = 'a' | 'b' | 'c';type Fn = UnionToOverloadedFn<U>; // (k: 'a') => void & (k: 'b') => void & (k: 'c') => void Copy
type U = 'a' | 'b' | 'c';type Fn = UnionToOverloadedFn<U>; // (k: 'a') => void & (k: 'b') => void & (k: 'c') => void
Convert a union to an overloaded function and extract tuple form. Note: this is an established trick but can be slow for very large unions.