0.1.0 • Published 2 years ago
ts-elm v0.1.0
Implements Elm's Result
type in TypeScript. Use it to make error handling explicit.
Instead of throwing errors, you create Results with the error
function.
Benefits:
- Type signatures indicate if a function can fail or not
- Ensures that errors are always handled
- Work with the data as if it always succeeds and add error handling where it makes the most sense
There is purposefully no type guards to detect if a Result
is Ok
or Err
. This is to force the use
of match
, which ensures that Errors are always handled.
:sparkles: Features
- Written in TypeScript
- Zero dependencies
:wrench: Example usage
:package: Install
npm
npm install ts-elm
yarn
yarn add ts-elm