v11.0.0-alpha.8
What's Changed
Bug Fixes
S.is Support For Simple TS Type Guards
if (S.is(data, S.string)) {
// data is now typed as string
}
// or
if (S.is(S.string, data)) {
// data is now typed as string
}The API supports schema and data in any order, so you or AI don't need to remember the correct order.
S.assert In TS Accept Free Order Of Arguments
The same change is done for S.assert, which we already had. Both options work the same:
S.assert(S.string, data)
S.assert(data, S.string)TypeScript Types Performance Improvements
Reduce the number of type instantiations in TypeScript up to 70%.
ReScript PPX
Record Spread
@schema
type baseUser = {
id: string,
}
@schema
type bot = {
...baseUser,
ownerId: string,
}Variant Spread
@schema
type httpError = ServerError | NotFound
@schema
type myError = InvalidEmail | ...httpErrorPolyvariant Inheritance
@schema
type httpError = [#ServerError, #NotFound]
@schema
type myError = [#InvalidEmail, httpError]Internal
Full Changelog: v11.0.0-alpha.7...v11.0.0-alpha.8