testdouble.js
testdouble.js copied to clipboard
Consider relaxing `thenReject` to accept types other than `Error`
Description
In a TypeScript code base, thenReject()
only accepts Error
s.
Issue
It would be nice to allow for different types of rejected values – along the lines of this JavaScript example in the official docs.
Thanks, Ilio.
Is this about the project's typings file? As a non-TS user, I've sorta let it be a free-for-all for anyone to contribute edits sensibly, so if you want to take a stab at a PR I would welcome it
Hi Justin,
According to their own declaration, in TypeScript Promise.reject
accepts a reason
of type any
. Since thenReject
is a short-hand for thenReturn(Promise.reject)
, I'd be inclined to use the same type. I'll try and submit a PR later.
Thank you, Ilio.