Functions
castFunction()
castFunction<
T,Args>(value): (...args) =>T
转换值为 Function
Type Parameters
| Type Parameter | Default type |
|---|---|
T | - |
Args extends any[] | [] |
Parameters
| Parameter | Type | Description |
|---|---|---|
value | MaybeFn<T, Args> | 检测值 |
Returns
Function
Parameters
| Parameter | Type |
|---|---|
...args | Args |
Returns
T
Example
ts
castFunction(1)
// => () => 1
castFunction(() => '1')
// => () => '1'