neverthrow is a TypeScript result type library that implements railway oriented programming. It provides a functional error handling framework using type-safe wrappers to represent operation outcomes as either success or failure variants, eliminating the need to throw exceptions.
The library features adapters that convert throwing functions and asynchronous promises into typed result objects. This allows asynchronous rejections and unsafe code to be handled as explicit return values rather than uncaught exceptions.
The framework covers a broad range of functional computation capabilities, including monadic chaining for sequential operations, error aggregation for collecting multiple failures, and result matching to ensure exhaustive error handling. It also provides mechanisms for error recovery, value transformation, and the execution of side effects on both success and failure tracks.
Additional support is provided for generator functions to implicitly handle errors and unwrap success values within a block.