2020-01-31 16:56:52 +01:00
|
|
|
/* eslint-disable @typescript-eslint/array-type */
|
|
|
|
|
2019-08-15 11:53:26 +02:00
|
|
|
export type FunctionPropertyNames<T> = {
|
|
|
|
[K in keyof T]: T[K] extends Function ? K : never
|
|
|
|
}[keyof T]
|
2019-08-09 08:17:16 +02:00
|
|
|
|
|
|
|
export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
|
|
|
export type PickWith<T, KT extends keyof T, V> = {
|
|
|
|
[P in KT]: T[P] extends V ? V : never
|
|
|
|
}
|
|
|
|
|
|
|
|
export type PickWithOpt<T, KT extends keyof T, V> = {
|
|
|
|
[P in KT]?: T[P] extends V ? V : never
|
|
|
|
}
|
2019-08-30 16:50:12 +02:00
|
|
|
|
|
|
|
// https://github.com/krzkaczor/ts-essentials Rocks!
|
|
|
|
export type DeepPartial<T> = {
|
|
|
|
[P in keyof T]?: T[P] extends Array<infer U>
|
|
|
|
? Array<DeepPartial<U>>
|
|
|
|
: T[P] extends ReadonlyArray<infer U>
|
|
|
|
? ReadonlyArray<DeepPartial<U>>
|
|
|
|
: DeepPartial<T[P]>
|
2019-09-04 11:39:25 +02:00
|
|
|
}
|