1.0.0 • Published 10 months ago

@gnuxie/typescript-result v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

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);