Skip to content

Latest commit

 

History

History
103 lines (60 loc) · 5.06 KB

CHANGELOG-pre.md

File metadata and controls

103 lines (60 loc) · 5.06 KB

1.0.0-beta.1 (2022-01-03)

Features

  • flat bundles and size reductions (753abdf)

1.0.0-beta.0 (2021-12-29)

  • feat!: add json() method and remove default object/array coercion (94b73c4)

Features

  • Make Array generic consistent with others (a82353f)

BREAKING CHANGES

  • types only, ArraySchema initial generic is the array type not the type of the array element. array<T>() is still the inner type.
  • object and array schema no longer parse JSON strings by default, nor do they return null for invalid casts.
object().json().cast('{}')
array().json().cast('[]')

to mimic the previous behavior

1.0.0-alpha.4 (2021-12-29)

Bug Fixes

Features

BREAKING CHANGES

  • mixed schema are no longer treated as the base class for other schema types. It hasn't been for a while, but we've done some nasty prototype slinging to make it behave like it was. Now typescript types should be 1 to 1 with the actual classes yup exposes.

In general this should not affect anything unless you are extending (via addMethod or otherwise) mixed prototype.

import {
-  mixed,
+  Schema,
} from 'yup';

- addMethod(mixed, 'method', impl)
+ addMethod(Schema, 'method', impl)
  • concat works shallowly now. Previously concat functioned like a deep merge for object, which produced confusing behavior with incompatible concat'ed schema. Now concat for objects works similar to how it works for other types, the provided schema is applied on top of the existing schema, producing a new schema that is the same as calling each builder method in order
  • The function version of when() has been changed to make it easier to type. values are always passed as an array and schema, and options always the second and third argument. this is no longer set to the schema instance. and all functions must return a schema to be type safe
 string()
-   .when('other', function (other) => {
-      if (other) return this.required()
+   .when('other', ([other], schema) => {
+     return other ? schema.required() : schema
  })

1.0.0-alpha.3 (2021-12-28)

Bug Fixes

Features

  • More intuitive Object generics, faster types (#1540) (912e0be)

1.0.0-alpha.2 (2020-12-18)

1.0.0-alpha.1 (2020-12-18)

Bug Fixes

  • types: make properties optional (ba107cb)
  • types: make properties optional (495ae84)

Features

  • remove unneeded Out type from schema (0bf9732)

1.0.0-alpha.0 (2020-12-14)

Features

  • add describe and meta to lazy, with resolve options (e56fea3)