Skip to content

castFunction

Functions

castFunction()

castFunction<T, Args>(value): (...args) => T

转换值为 Function

Type parameters

ParameterValue
T-
Args extends any[][]

Parameters

ParameterTypeDescription
valueMaybeFn<T, Args>检测值

Returns

Function

Parameters
ParameterType
...argsArgs
Returns

T

Example

ts
castFunction(1)
// => () => 1

castFunction(() => '1')
// => () => '1'