ts-reset icon indicating copy to clipboard operation
ts-reset copied to clipboard

Promise Union - This expression is not callable.

Open stanislav215 opened this issue 1 year ago • 2 comments

Hello,

From version 0.6.0 I am getting errors on function that returns union of promises.

This expression is not callable. Each member of the union type '{ <TResult1 = number, TResult2 = never>(onfulfilled?: ((value: number) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | null | undefined): Promise<...>; <TResult1 = number, TResult2 = never>(onfulfilled?: ((value: number) => TResult1 | PromiseLike...' has signatures, but none of those signatures are compatible with each other.typescript(2349)

probably related to: ts-reset/dist/promise-catch.d.ts

here is url, where issue is recreated: https://codesandbox.io/p/sandbox/4lnj2q

stanislav215 avatar Sep 05 '24 13:09 stanislav215

I'm having the same issue.

Same repro in TS playground:

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAIgAIwjAhgGwLQwJ5gCmAzgMZTBgwD0Mx2UJhMCA3AFDukQB2x8AVx7BeABSgQQwYoTgBeOD0IB3OOMnTCACi2NiASnkA+OAG8AvofTF2cOAB81EqTIA8PASABGhKEdsOThpuAG4QwAAmRhzcfPBgzpoA6sAwABYAqsK8AEokApjwCkqq6i7auiSGciYWVsRB5a4BHt6+gWGR7NGcQiI8ZZoAdOmEPDp61bWWHAnBhCnpWf15xAUwI2ljE1XGZjPsQA

wojtekmaj avatar Sep 11 '24 21:09 wojtekmaj

Probably because Promise<number | void> is not exactly the same as Promise<number> | Promise<void>

tanmatra avatar Sep 22 '25 15:09 tanmatra