never-catch
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

never-catch

  • No boilerplate
  • Type support
  • Auto type infer
const divideTenBy = (a: number) => {
    if (a === 0) {
        return err('divide by zero');
    } else {
        return ok(10 / a);
    }
};

const result = divideTenBy(5);
if (result.ok) {
    console.log(result.value);// OK
} else {
    console.log(result.error);// Ok
    console.log(result.value);// TS2339: Property 'value' does not exist on type 'Err '.
}

Email: mnafisiasl@gmail.com

Package Sidebar

Install

npm i never-catch

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

27.5 kB

Total Files

8

Last publish

Collaborators

  • mrnafisia