Last active
May 4, 2022 21:14
-
-
Save matthewsimo/cd9e80a012fcd738a81df51ac6398d67 to your computer and use it in GitHub Desktop.
Revisions
-
matthewsimo revised this gist
May 4, 2022 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ export type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>; export type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never; // expands object types recursively export type ExpandRecursively<T> = T extends object ? T extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]> } : never : T; export type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; }; -
matthewsimo created this gist
May 4, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>; type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never; // expands object types recursively type ExpandRecursively<T> = T extends object ? T extends infer O ? { [K in keyof O]: ExpandRecursively<O[K]> } : never : T; type DeepPartial<T> = { [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; };