forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.d.ts
23 lines (21 loc) · 884 Bytes
/
utils.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
declare global {
type KeysMatching<T, V> = {
[K in keyof T]-?: T[K] extends V ? K : never;
}[keyof T];
type DeepPartial<T> = T extends string | number | bigint | boolean | null | undefined | symbol | Date
? T | undefined
: T extends Array<infer ArrayType>
? Array<DeepPartial<ArrayType>>
: T extends ReadonlyArray<infer ArrayType>
? ReadonlyArray<ArrayType>
: T extends Set<infer SetType>
? Set<DeepPartial<SetType>>
: T extends ReadonlySet<infer SetType>
? ReadonlySet<SetType>
: T extends Map<infer KeyType, infer ValueType>
? Map<DeepPartial<KeyType>, DeepPartial<ValueType>>
: T extends ReadonlyMap<infer KeyType, infer ValueType>
? ReadonlyMap<DeepPartial<KeyType>, DeepPartial<ValueType>>
: { [K in keyof T]?: DeepPartial<T[K]> };
}
export {};