Last active
June 28, 2022 09:52
-
-
Save Aaronius/7d476cb4f906b4892c453a76fe4cc285 to your computer and use it in GitHub Desktop.
CombineObjectsFromTuple
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
type Combine<A, B> = Omit<A, keyof B> & | |
Omit<B, keyof A> & { [K in keyof A & keyof B]: A[K] | B[K] }; | |
type CombineObjectsFromTuple<T> = T extends [infer K, ...infer R] | |
? Combine<K, CombineObjectsFromUnion<R>> | |
: T; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment