Skip to content

applyEach arguments position #1228

@jamiebuilds

Description

@jamiebuilds

Currently the applyEach and applyEachSeries functions have the following type signature:

async.applyEach(fns, ...args?, callback?)

Having a rest parameter in the middle of the arguments list is very difficult to write a type annotation for. It's currently not possible in either Flow or TypeScript, which is why you see stuff like this (I'm writing a similar type definition for Flow right now).

Would it be okay to switch the argument order around and make callback nullable so it is like this?

async.applyEach(fns, callback | null, ...args?)

Or use an array instead of a rest parameter?

async.applyEach(fns, args?: Array<any>, callback?)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions