Skip to content

Releases: arktypeio/arktype

@arktype/[email protected]

05 Jun 05:16
a7252a6
Compare
Choose a tag to compare

Patch Changes

[email protected]

05 Jun 05:16
a7252a6
Compare
Choose a tag to compare
[email protected] Pre-release
Pre-release

Fix autocomplete for private aliases

const $ = scope({
	"#kekw": "true",
	// now correctly completed as "kekw" without the # prefix,
	outerKek: {
		kekw: "kek"
	}
})

[email protected]

01 Jun 20:43
12b3189
Compare
Choose a tag to compare

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]

01 Jun 20:43
12b3189
Compare
Choose a tag to compare

Patch Changes

@arktype/[email protected]

01 Jun 20:43
12b3189
Compare
Choose a tag to compare

Patch Changes

@arktype/[email protected]

01 Jun 20:43
12b3189
Compare
Choose a tag to compare

Patch Changes

[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