NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #4015 most downloaded on npm
A simple and composable way to validate data in JavaScript (and TypeScript).
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.3 years
Some releases are documented
notes for 15 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
90 releases · first in 2017
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.
Validators must now return `true`, `false` or an error reason string. Previously any truthy value would be considered valid. Now you can provide more
Validators must now return true, false or an error reason string. Previously any truthy value would be considered valid. Now you can provide more information for the thrown errors by providing a string which will be attached as error.reason. However, this means that truthy string values now equate to invalid, not valid.
Property validators now receive data as their second argument. Previously you only had access to the property value, but now you also have access to the entire object's data.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
`object` structs are no longer optional-ish. Previously object struct types would not throw if undefined was passed and no properties were required. T
object structs are no longer optional-ish. Previously object struct types would not throw if undefined was passed and no properties were required. This was not only confusing, but complex to maintain. Now if you want an object struct to be optional, use the struct.optional(...) helper.
Removed the Struct.default method. If you need to get the default value, use the Struct.validate or Struct.assert methods's return value instead.
dict, enum, intersection, union and tuple structs. These are all available as struct.dict, struct.enum, etc.Nothing published for this version
Nothing published for this version
The `validate()` method now returns `[ error, result ]`. Previously it only had a single return value, which necessitated extra type checking to see i
The validate() method now returns [ error, result ]. Previously it only had a single return value, which necessitated extra type checking to see if the value was an error or a result. Now you can just destructure the array to get either return value, for easier coding.
Errors have been simplified, removing "codes". Previously there were multiple types of errors that were thrown and you could differentiate between them with the error.code property. But the other properties of the error already let you infer the code, so having multiple types of errors made for a larger API surface without much benefit.
Nothing published for this version
Structs are now functions again. :smile: They are built on the same underlying schema classes underneath though, since that helps the code structure.
struct = Struct({ ... }) syntax the structs themselves have changed to be function.Struct(data). Previously you had to use Struct.assert(data). Although the assert method (and others) are still there, the basic case is a bit terser and more similar to the struct-initializing APIs in other languages.Nothing published for this version
Structs are now classes instead of functions. This is better in terms of the API being a bit less magic-y. It's also useful so that we can add other h
assert method. What was previously struct(data) is now struct.assert(data).Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →