The type of the successful value.
The type of the error.
import Staquia, { OverflowError } from "staquia";
const system = Staquia.create("!", "a", "z", 5, 15, 0.15);
const result = system.next(system.forge("zzzzz"));
if (result.ok) {
console.log(result.value.toString()); // the position
} else if (result.error instanceof OverflowError) {
console.log(result.error.message); // explains that "zzzzz" is already the last value of N
}
The outcome of an operation that can fail: a success with a
value, or a failure with anerror.The library never throws: every function that can fail returns a
Result. Checkokfirst, then TypeScript lets you readvalueorerror.