Welcome to @ts-rust, a TypeScript monorepo that brings Rust-inspired utilities
and patterns to JavaScript environments. This project adapts concepts from Rust’s
standard library (std)—such as Option and Result—into idiomatic TypeScript, offering
type-safe, robust alternatives to traditional JavaScript error handling and optional
value management.
The primary package, @ts-rust/std, provides a foundation for building reliable
applications with Rust-like ergonomics, while @ts-rust/shared contains shared
utilities used across the monorepo’s packages.
- Rust-Inspired Primitives: Implements
Option<T>andResult<T, E>with TypeScript’s type system. - Type Safety: Leverages TypeScript’s static typing to catch errors at compile time.
- Asynchronous Support: Includes
PendingOptionandPendingResultfor handling async operations. - Monorepo Structure: Managed with pnpm workspaces for modular development and dependency management.
-
@ts-rust/std: The core library, providing Rust’s std-like functionality for TypeScript.- Key exports:
Option,some,none,PendingOption,pendingOption,Result,ok,err,PendingResult,pendingResult. See README.md for more details - Location:
packages/std.
- Key exports:
-
@ts-rust/shared: Internal shared utilities supporting@ts-rust/stdand future packages.- Not intended for public use; bundled into dependent packages.
- Location:
packages/shared.
This project is licensed under the MIT License — see the LICENSE file for details.
We welcome contributions! If you find a bug or have a feature request:
- Check the issue tracker to see if it’s already reported.
- Open a new issue with a clear title, description, and reproduction steps (if applicable).
- For code contributions, fork the repo, create a branch, and submit a pull request.
Please follow the code of conduct when interacting with the project.
Inspired by Rust’s std library and its focus on safety and performance.
Built with ❤️ using TypeScript, pnpm, and Rollup.