Superstruct
A simple and composable way to validate data in JavaScript
...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. ...