16 lines
420 B
TypeScript
16 lines
420 B
TypeScript
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
|
|
}
|