neverthrow icon indicating copy to clipboard operation
neverthrow copied to clipboard

fromSafePromise error type must be "never"

Open lmcsu opened this issue 3 years ago • 0 comments

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

lmcsu avatar Jul 30 '22 14:07 lmcsu