neverthrow
neverthrow copied to clipboard
Type-Safe Errors for JS & TypeScript
In order to keep all my API coherent, all my methods return `Result` types, but since some of those methods can't produce an error, they are typed as `Result` Then...
Would be great to support tree shaking for bundlers like Webpack, Vite, rollup, esbuild, etc. I imagine this package has no global side effects, so simply adding the following to...
This PR implements support for passing `this` context to the generator function in `safeTry`, following the established pattern already implemented in similar libraries like [Effect](https://effect.website/docs/getting-started/using-generators/#passing-this) and [typescript-result](https://www.typescript-result.dev/chaining-vs-generator-syntax#this-context). Closes #632 ###...
I would like to propose a feature enhancement for `neverthrow`'s `safeTry` that enables passing the `this` context to the function being executed. This change would mimic the interface of effect-ts...
Currently, the link in the README outline to `ResultAsync.map` is broken: it links to `Result.asyncMap`. This is because GitHub markdown automatically creates anchor IDs for headings by lower-casing and stripping...
Hi, I'm trying to understand this behaviour of neverthrow: ``` import { err, ok } from "neverthrow"; class F1Error extends Error { } function f1() { if (Math.random() > 0.5)...
Like Promise.any, a nice util would be to have ResultAsync.any which will return any 1 successful result in the array
It would be really helpful to add a function `toJSON` for `Result` and `AsyncResult` that gets ride of functions (map, mapErr, unwrapOr...etc) and changes the `isOk` and `isErr` functions into...
I love neverthrow - I'd been using a custom hacked together Result class that required a TON of annotation and have loved that neverthrow mostly gets the inferred types right....
Hey, There are many places in the codebase that make unsafe assumptions about types passed in, for example code does stuff like: ``` andThen(f: any): any { return new ResultAsync(...