Releases: arktypeio/arktype
[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]
@arktype/[email protected]
Patch Changes
- #986
fbcdddc
Thanks @ssalbdivad! -
@arktype/[email protected]
Patch Changes
- Updated dependencies [
ebe3408
]:- @arktype/[email protected]
- [email protected]
@arktype/[email protected]
Patch Changes
- #974
52be860
Thanks @ssalbdivad! - Pipe and narrow bug fixes (see arktype CHANGELOG)
[email protected]
- Fix an incorrect return value on pipe sequences like the following:
const Amount = type(
"string",
":",
(s, ctx) => Number.isInteger(Number(s)) || ctx.invalid("number")
)
.pipe((s, ctx) => {
try {
return BigInt(s)
} catch {
return ctx.error("a non-decimal number")
}
})
.narrow((amount, ctx) => true)
const Token = type("7<string<=120")
.pipe(s => s.toLowerCase())
.narrow((s, ctx) => true)
const $ = scope({
Asset: {
token: Token,
amount: Amount
},
Assets: () => $.type("Asset[]>=1").pipe(assets => assets)
})
const types = $.export()
// now correctly returns { token: "lovelace", amount: 5000000n }
const out = types.Assets([{ token: "lovelace", amount: "5000000" }])
// (was previously { token: undefined, amount: undefined })
@arktype/[email protected]
Patch Changes
-
#971
79c2b27
Thanks @ssalbdivad! - Provide recommended tsconfig viatsconfig.base.json
, e.g.:tsconfig.json
{ "extends": "@arktype/util/tsconfig.base.json", // your settings here }
@arktype/[email protected]
Patch Changes
-
#971
79c2b27
Thanks @ssalbdivad! - Pipe and narrow bug fixes (see arktype CHANGELOG) -
Updated dependencies [
79c2b27
]:- @arktype/[email protected]