( value: Value<T, TArgs>, ...args: NoInfer<TArgs> )
| 1 | export type Value<T, TArgs extends any[] = []> = T | ((...args: TArgs) => T) |
| 2 | |
| 3 | export function value<T, TArgs extends any[]>( |
| 4 | value: Value<T, TArgs>, |
| 5 | ...args: NoInfer<TArgs> |
| 6 | ): T extends Value<infer U, any> ? U : never { |
| 7 | if (typeof value === 'function') { |
| 8 | return (value as any)(...args) |
| 9 | } |
| 10 | |
| 11 | return value as any |
| 12 | } |
| 13 | |
| 14 | /** |
| 15 | * Returns the value if it is defined, otherwise returns the fallback |
no outgoing calls
no test coverage detected