Skip to content

只留下value为函数的key

typescript
type FK = {
    fn: (n: string) => {}
    na: string
}

type PickByValue<T, P> = {
    [K in
    {
        [K in keyof T]: T[K] extends P ? K : never
    }[keyof T]
    ]: T[K]
}

type Fn = PickByValue<FK, Function>