Last active
February 14, 2018 11:41
-
-
Save sigorilla/77a9a87bdd7d6e2f23b56442c1cbad8e to your computer and use it in GitHub Desktop.
DeepPartial<T>
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 DeepPartial<T> = | |
T extends any[] ? DeepPartialArray<T[number]> : | |
T extends object ? DeepPartialObject<T> : | |
T; | |
interface DeepPartialArray<T> extends Array<DeepPartial<T>> { } | |
type DeepPartialObject<T> = { | |
[P in keyof T]?: DeepPartial<T[P]>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment