Skip to content

Releases: arktypeio/arktype

[email protected]

29 May 20:47
c412501
Compare
Choose a tag to compare

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]

29 May 17:02
d847190
Compare
Choose a tag to compare
  • Error thrown by .assert or out.throw() is now an instance of AggregateError, with the cause being an ArkErrors 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]

29 May 17:02
d847190
Compare
Choose a tag to compare

Patch Changes

  • #984 ebe3408 Thanks @ssalbdivad! - - Throw an error immediately if multiple versions of @arktype/util are imported

@arktype/[email protected]

29 May 17:02
d847190
Compare
Choose a tag to compare

Patch Changes

@arktype/[email protected]

29 May 20:47
c412501
Compare
Choose a tag to compare

@arktype/[email protected]

29 May 17:02
d847190
Compare
Choose a tag to compare

Patch Changes

@arktype/[email protected]

25 May 10:02
8adfd43
Compare
Choose a tag to compare

Patch Changes

[email protected]

25 May 10:02
8adfd43
Compare
Choose a tag to compare
[email protected] Pre-release
Pre-release
  • 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 })

#974

@arktype/[email protected]

24 May 22:00
cd6cff2
Compare
Choose a tag to compare

Patch Changes

  • #971 79c2b27 Thanks @ssalbdivad! - Provide recommended tsconfig via tsconfig.base.json, e.g.:

    tsconfig.json

    {
    	"extends": "@arktype/util/tsconfig.base.json",
    	// your settings here
    }

@arktype/[email protected]

24 May 22:00
cd6cff2
Compare
Choose a tag to compare

Patch Changes