v2.0.0
Changelog: v1.2.0...v2.0.0
-
Set
,Map
, andPromise
are now separate types in the type system. -
ValidationError
accepts a message argument in the constructor.formatIssues
static method toValidationError
formats issues as a human-readable error message if a message argument is omitted when constructing a newValidationError
instance. -
Composite async shapes are now applied sequentially. For example, array elements are parsed one at a time.
-
String
,Number
, andBoolean
instances are unwrapped during coercion. -
Coercion methods return
d.NEVER
to indicate that coercion isn't possible. -
ObjectShape.isPlain
returnstrue
if the shape only accepts objects withnull
orObject
prototype. -
StringShape.regex
built-in check uses a regex source as a key. -
IntersectionShape
andUnionShape
don't apply checks if any of the underlying shapes have raised an issue. -
PromiseShape
applies unsafe checks even if the underlying shape raised an issue. -
TransformShape
is applied through thePipeShape
, instead of being a self-sufficient composite. -
Callbacks passed to
catch
,refine
,check
, andtransform
receives input, issues, options, and other intermediate parsing details. -
All properties of the
Issue
interface are now optional, andPartial<Issue>
isn’t used anymore. -
Removed
isMultipleOf
: it caused themultipleOf
check to be super slow and fixed a rare case. If you want to use real numbers as divisors, create a custom check that rounds the input value to a precision. -
ObjectShape
andRecordShape
don’t allow arrays anymore. -
JSONShape
was removed. I plan to move it to a separate package.