@gnuxie/typescript-result
v1.0.0
Published
This is just a simple result type so that we can have type checked error handling pretty please.
Downloads
545
Readme
Typescript result
This is just a simple result type so that we can have type checked error handling pretty please.
This allows you to do cool stuff like this:
const result = await api.getCatPictures();
if (isError(result)) {
// forced to handle error here before we can access `result.ok`.
displayError(`We couldn't get the cat pictures`, result.error);
return;
}
displayCats(result.ok);