Skip to content

v11.0.0-alpha.8

Choose a tag to compare

@DZakh DZakh released this 15 Jun 08:59
45c25d5

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.

By @DZakh in #264

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)

By @DZakh in #264

TypeScript Types Performance Improvements

Reduce the number of type instantiations in TypeScript up to 70%.

By @DZakh in #269

ReScript PPX

Record Spread

@schema
type baseUser = {
  id: string,
}

@schema
type bot = {
  ...baseUser,
  ownerId: string,
}

By @DZakh in #266

Variant Spread

@schema
type httpError = ServerError | NotFound

@schema
type myError = InvalidEmail | ...httpError

By @DZakh in #266

Polyvariant Inheritance

@schema
type httpError = [#ServerError, #NotFound]

@schema
type myError = [#InvalidEmail, httpError]

By @DZakh in #255

Internal

  • Migrate type testing from ts-expect to vitest's expectTypeOf by @DZakh in #268

Full Changelog: v11.0.0-alpha.7...v11.0.0-alpha.8