Skip to content

Releases: arktypeio/arktype

@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

@arktype/[email protected]

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

Patch Changes

[email protected]

24 May 22:00
cd6cff2
Compare
Choose a tag to compare
[email protected] Pre-release
Pre-release
  • Fix a crash when piping to nested paths (see #968)
  • Fix inferred input type of .narrow (see #969)
  • Throw on a pipe between disjoint types, e.g.:
// Now correctly throws ParseError: Intersection of <3 and >5 results in an unsatisfiable type
const t = type("number>5").pipe(type("number<3"))

// Previously returned a Disjoint object
  • Mention the actual value when describing an intersection error:
const evenGreaterThan5 = type({ value: "number%2>5" })
const out = evenGreaterThan5(3)
if (out instanceof type.errors) {
	/*
    value 3 must be...
      • a multiple of 2
      • at most 5
    */
	console.log(out.summary)
}

// was previously "value must be..."

Thanks @TizzySaurus for reporting the last two on our Discord!

#971

@arktype/[email protected]

22 May 22:32
5aa6a73
Compare
Choose a tag to compare

Patch Changes

@arktype/[email protected]

22 May 22:32
5aa6a73
Compare
Choose a tag to compare

Patch Changes