ts-results: Rust-like Result and Option for TypeScript
JSON →ts-results is a TypeScript library that provides compile-time error checking and optional values, inspired by Rust's `Result` and `Option` enums. It offers a type-safe approach to handling fallible operations and potential absence of values without relying on exceptions or `null`/`undefined`. The current stable version, 3.3.0, was last published in 2021. This package differentiates itself by offering a lightweight, focused implementation of these core algebraic data types, in contrast to more comprehensive functional programming libraries. It enables developers to explicitly model success (`Ok`) or failure (`Err`) states and presence (`Some`) or absence (`None`) of a value, leveraging TypeScript's type system to ensure these states are handled at compile time, thereby reducing runtime errors.
Traffic · last 30 days ↑11% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · BD · 🇩🇪 Germany