Releases: arktypeio/arktype
@arktype/[email protected]
Patch Changes
- Updated dependencies [
232fc42
]:- @arktype/[email protected]
- [email protected]
[email protected]
Fix autocomplete for private aliases
const $ = scope({
"#kekw": "true",
// now correctly completed as "kekw" without the # prefix,
outerKek: {
kekw: "kek"
}
})
[email protected]
Chainable Constraints
Added satisfying
, matching
, divisibleBy
, atLeast
, moreThan
, atMost
, lessThan
, atLeastLength
, moreThanLength
, atMostLength
, lessThanLength
, atOrAfter
, laterThan
, atOrBefore
, and earlierThan
as chainable expressions mirroring existing comparator expressions.
This can be especially convenient for applying constraints to previously defined types like this:
const evenNumber = type("number%2")
const evenNumberLessThan100 = evenNumber.lessThan(100)
const equivalentSingleDeclaration = type("number%2<100")
Also works great for chaining off non-string-embedable expressions outside a scope:
const myBoundedArray = type({ foo: "string" })
.array()
.atLeastLength(5)
.atMostLength(20)
These chained operations are also typesafe:
// TypeError: Divisor operand must be a number (was a string)
type("string").divisibleBy(2)
Cyclic Types Bug Fix
Fixed an issue causing standalone types referencing cyclic types in a scope to crash on JIT-compiled runtime validation.
Types like this will now work correctly:
const $ = scope({
box: {
"box?": "box"
}
})
const box = $.type("box|null")
@arktype/[email protected]
Patch Changes
- #995
317f012
Thanks @ssalbdivad! - AddleftIfEqual
type utility
@arktype/[email protected]
Patch Changes
-
#995
317f012
Thanks @ssalbdivad! - Fixed a cyclic traversal case (see arktype CHANGELOG) -
Updated dependencies [
317f012
]:- @arktype/[email protected]
@arktype/[email protected]
Patch Changes
- Updated dependencies [
317f012
]:- @arktype/[email protected]
- [email protected]
[email protected]
Add a "digits"
keyword for strings consisting exclusively of 0-9.
Fix an issue causing index signatures with constraints like regex to be considered invalid as definitions.
The following is valid and now will be allowed as a definition.
const test = scope({
svgPath: /^\.\/(\d|a|b|c|d|e|f)+(-(\d|a|b|c|d|e|f)+)*\.svg$/,
svgMap: {
"[svgPath]": "digits"
}
}).export()
[email protected]
-
Error thrown by
.assert
orout.throw()
is now an instance of AggregateError, with the cause being anArkErrors
array. -
Throw an error immediately if multiple versions of
arktype
are imported -
Fix an issue causing some discriminated unions including a prototype like
string | RegExp
to return incorrect validation results.
@arktype/[email protected]
Patch Changes
- #984
ebe3408
Thanks @ssalbdivad! - - Throw an error immediately if multiple versions of@arktype/util
are imported
@arktype/[email protected]
Patch Changes
-
#984
ebe3408
Thanks @ssalbdivad! - -
Updated dependencies [
ebe3408
]:- @arktype/[email protected]