neverthrow
neverthrow copied to clipboard
fromSafePromise error type must be "never"
const r = ResultAsync
.fromSafePromise(new Promise<number>((resolve) => resolve(123)))
.andThen((num) => {
return errAsync(num);
});
its type is ResultAsync<never, unknown> instead of ResultAsync<never, number>
because fromSafePromise returns ResultAsync<type, unknown> and "unknown" is kinda heavier than anything else I guess.
so everywhere we must write it as fromSafePromise<type, never> to make it work