Type alias ExtractFunction<T>

ExtractFunction<T>: T extends AnyFunction<infer P, infer R>
    ? ((...args) => 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

Note

does not work with function overloads.

import type { ExtractFunction } from 'type-plus'

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

Generated using TypeDoc