Type Alias ExtractFunction<T>

ExtractFunction<T>: T extends AnyFunction<infer P, infer R>
    ? ((...args: P) => R)
    : never

Extract the function signature from a composite type T.

It works with interact of functions, but not on function overloads and union.

Type Parameters

does not work with function overloads.

import type { ExtractFunction } from 'type-plus'

type R = ExtractFunction<{
() => void
a: 1
}> // () => void