v11.0.0-alpha.2
What's Changed
S.jsonString now a schema.
Perviously you'd call it as a modifier S.jsonString(schema), now you can use S.jsonString as a standalone schema:
S.parseOrThrow(data, S.jsonString) // Validates that data is a valid JSON string and returns it as a string
S.parseOrThrow(data, S.jsonString.with(S.to, S.number)) // Parses JSON string and transforms it into a number
S.parseOrThrow(data, S.number.with(S.to, S.jsonString)) // Validates that data is a number and serializes it into JSON stringYou can also use S.jsonStringWithSpace(2).
Require enabling
There's a new concept of enabling schemas before using them. This is needed to provide a nice API without nasty parenthesis while tree-shake functions you don't use.
In the release this is introduced for S.json and S.jsonString/S.jsonStringWithSpace, so you need to call this in the root of your program:
S.enableJson();
S.enableJsonString();Added S.Infer type helper
This is what AI usually wants to use first, so I added it as an alias for S.Output.
Full Changelog: v11.0.0-alpha.1...v11.0.0-alpha.2