Skip to content

Functions ​

castFunction() ​

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

转换值为 Function

Type Parameters ​

Type ParameterDefault type
T-
Args extends any[][]

Parameters ​

ParameterTypeDescription
valueMaybeFn<T, Args>检测值

Returns ​

Function

Parameters ​
ParameterType
...argsArgs
Returns ​

T

Example ​

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

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