diff options
Diffstat (limited to 'server/typings/utils.ts')
-rw-r--r-- | server/typings/utils.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/typings/utils.ts b/server/typings/utils.ts index 4b5cf4d7e..1abb4f73e 100644 --- a/server/typings/utils.ts +++ b/server/typings/utils.ts | |||
@@ -11,3 +11,12 @@ export type PickWith<T, KT extends keyof T, V> = { | |||
11 | export type PickWithOpt<T, KT extends keyof T, V> = { | 11 | export type PickWithOpt<T, KT extends keyof T, V> = { |
12 | [P in KT]?: T[P] extends V ? V : never | 12 | [P in KT]?: T[P] extends V ? V : never |
13 | } | 13 | } |
14 | |||
15 | // https://github.com/krzkaczor/ts-essentials Rocks! | ||
16 | export type DeepPartial<T> = { | ||
17 | [P in keyof T]?: T[P] extends Array<infer U> | ||
18 | ? Array<DeepPartial<U>> | ||
19 | : T[P] extends ReadonlyArray<infer U> | ||
20 | ? ReadonlyArray<DeepPartial<U>> | ||
21 | : DeepPartial<T[P]> | ||
22 | }; | ||