Closed
Description
Promise.catch
can be used to silence rejections and to make the result optional by converting rejections to undefined
(or more generally, to add any other result type to the promise chain). This is not possible anymore with better-ts-lib:
// before (TS lib)
const promise1 = Promise.resolve("a").then(() => 42, () => undefined); // Promise<number | undefined>
const promise2 = Promise.resolve(42).catch(() => undefined); // Promise<number | undefined>
// after (better-ts-lib)
const promise1 = Promise.resolve("a").then(() => 42, () => undefined); // Promise<number | undefined>
const promise2 = Promise.resolve(42).catch(() => undefined); // <=== type error
Could you add a catch<U>
similar to the existing then<U>
?