This project is a lightweight validation library for JavaScript and TypeScript that helps you define data “shapes” and validate runtime values against them. Instead of relying only on compile-time typing, it focuses on the reality that many apps receive unknown input from APIs, forms, and external systems, and those values need runtime checks. Its API is intentionally familiar if you’ve used TypeScript, Flow, Go structs, or GraphQL schemas, but the output is oriented around runtime correctness. When validation fails, it can throw or return detailed errors that are useful both for debugging and for communicating issues back to end users or API clients. The library is designed to be composable, so you can build larger validators from small pieces rather than rewriting similar checks in multiple places. It’s especially effective in REST or GraphQL servers, but it’s equally useful for protecting internal boundaries where untrusted or loosely typed data can slip in.
Features
- Runtime data validation for JavaScript and TypeScript values
- Composable “struct” definitions for building complex schemas from primitives
- Detailed, developer-friendly validation errors for failed checks
- Familiar type-annotation style inspired by common schema and type systems
- Works well for validating external API inputs and internal data boundaries
- Flexible usage patterns that support throwing errors or returning results