typeidFunction

View sourcetypeidFunction<F extends object>(_func: F, input: TupleConstructor<Parameters<F>>, output: Constructor<ReturnType<F>>): TypeId

Derives a function-signature TypeId lookup key from constructor information.

The function value is used only for type inference and is not called or inspected. The ID is built from the constructors in input and output: fn(Input1,Input2):Output. Use the result with APIs that register or look up metadata for the function signature. Input order is preserved, and an empty input array produces fn():Output.

Examples

const addId = typeidFunction((left, right) => left + right, [Number, Number], Number)
// addId === 'fn(Number,Number):Number'

Type Parameters

F extends object

Parameters

NameDescriptionDefault
_func

A function value used for type inference; it is not called.

—
input

Constructors for the function’s parameters, in order.

—
output

The constructor for the return value.

—

Returns

An ID in the form fn(Input1,Input2):Output.