type ApplyFunc = (...args: T[]) => any; interface ApplyOrReturn { >(args: T[], test: F): ReturnType; (args: T[], test: F extends Function ? ApplyFunc : F): F; (args: T[]): >(test: F) => ReturnType; (args: T[]): (test: F extends Function ? ApplyFunc : F) => F; } /** * If `test` is function it calls with applied first argument, otherwise just returns `test` * * @param {Array} args Arguments passed to `test` if it's a function * @param {*} test if `test` is function it's called with `args` * @return {*} * @example * * applyOrReturn([1,2,3], (...args) => args) // => [1,2,3] * applyOrReturn([1,2,3], 'test') // => 'test' */ declare const _default: ApplyOrReturn; export default _default;