-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Description
Hi, I'm trying to understand this behaviour of neverthrow:
import { err, ok } from "neverthrow";
class F1Error extends Error { }
function f1() {
if (Math.random() > 0.5) {
return err(new F1Error());
}
return ok(true);
}
class F2Error extends Error { }
function f2() {
if (Math.random() > 0.5) {
return err(new F2Error());
}
const f1Result = f1();
if (f1Result.isErr()) {
return f1Result;
}
return ok(true);
}
const finalResult = f2();
Now in vscode or typescript playground, when I hover on finalResult, it gives me Err<unknown, F1Error> | Ok<boolean, unknown>.
I think it should be Err<unknown, F1Error> | Err<unknown, F2Error> | Ok<boolean, unknown>? or is it an expected behaviour?
I'm new to both typescript and neverthrow, please correct me if I'm asking a stupid question.
Many thanks.
Metadata
Metadata
Assignees
Labels
No labels