aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/typings/utils.ts
blob: ed0fca3d156179acdea9d1c108e698680885094f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export type FunctionPropertyNames<T> = {
  [K in keyof T]: T[K] extends Function ? K : never
}[keyof T]

export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>

export type ValueOf <T, KT extends keyof T> = T[KT]

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
}