Add Methods type by ehmicky · Pull Request #1066 · sindresorhus/execa (original) (raw)
Fixes #1062.
This PR adds the Methods['execa'], Methods['execaNode'] and Methods['$'] types. Those are the types of execa/execa(options), and so on.
This is useful for TypeScript users passing bound/curried instances of execa around.
Using ReturnType<execa> does not work due to the overloading of the execa() function (execa(options), execa(file, args, options), template string syntax). So, ReturnType<execa> is the return type of execa(options) but also of execa(file, args, options) (i.e. a ResultPromise), which makes assigning it not work.