-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
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>
?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed