You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I try to call it with a function that has the following signature:
type MaybePromise<T> = () => T | Promise<T>
(note: Promise implements PromiseLike)
The type inference doesn't seem to be considering both overloads. It seems like it should, which is why I'm filing this issue.
As a temporary fix I've made a pull request to use a union type for the fn return value, but this feels like I'm working around a compiler bug.
Thanks Ryan. Sounds like given that this is a known issue and it's the mutli-argument case it is unlikely to be supported. I will try to get the bluebird definitions updated on DefinatelyTyped.
The DefinatelyTyped definitions for bluebird have an overload that looks like this:
If I try to call it with a function that has the following signature:
(note: Promise implements PromiseLike)
The type inference doesn't seem to be considering both overloads. It seems like it should, which is why I'm filing this issue.
As a temporary fix I've made a pull request to use a union type for the fn return value, but this feels like I'm working around a compiler bug.
DefinitelyTyped/DefinitelyTyped#7958
For a min-repro, see the PR above. The test cases I added fail if I don't make the non-test changes in that PR (switching to a union type).
The text was updated successfully, but these errors were encountered: