Releases: arktypeio/arktype
Releases · arktypeio/arktype
[email protected]
Fix constrained narrow/pipe tuple expression input inference
Previously constraints were not stripped when inferring function inputs for tuple expressions like the following:
// previously errored due to data being inferred as `number.moreThan<0>`
// now correctly inferred as number
const t = type(["number>0", "=>", data => data + 1])
Fix a bug where paths including optional keys could be included as candidates for discrimination (see #960)
Throw descriptive parse errors on unordered unions between indiscriminable morphs and other indeterminate type operations (see #967)
@arktype/[email protected]
Patch Changes
- #1011
2be4f5b
Thanks @ssalbdivad! - ### Add a newarrayEquals
util for shallow array comparisons
@arktype/[email protected]
Patch Changes
-
#1011
2be4f5b
Thanks @ssalbdivad! - ### Improve discrimination logic across several issues (see primary release notes at ArkType's CHANGELOG) -
Updated dependencies [
2be4f5b
]:- @arktype/[email protected]
@arktype/[email protected]
Minor Changes
-
#1011
2be4f5b
Thanks @ssalbdivad! - ### Throw by default when attest.instantiations() exceeds the specified benchPercentThresholdTests like this will now correctly throw inline instead of return a non-zero exit code:
it("can snap instantiations", () => { type Z = makeComplexType<"asbsdfsaodisfhsda"> // will throw here as the actual number of instantiations is more // than 20% higher than the snapshotted value attest.instantiations([1, "instantiations"]) })
Snapshotted completions will now be alphabetized
This will help improve stability, especially for large completion lists like this one which we updated more times than we'd care to admit 😅
attest(() => type([""])).completions({ "": [ "...", "===", "Array", "Date", "Error", "Function", "Map", "Promise", "Record", "RegExp", "Set", "WeakMap", "WeakSet", "alpha", "alphanumeric", "any", "bigint", "boolean", "creditCard", "digits", "email", "false", "format", "instanceof", "integer", "ip", "keyof", "lowercase", "never", "null", "number", "object", "parse", "semver", "string", "symbol", "this", "true", "undefined", "unknown", "uppercase", "url", "uuid", "void" ] })
Patch Changes
- Updated dependencies [
2be4f5b
]:- @arktype/[email protected]
- [email protected]
[email protected]
Add an AnyType
type that allows a Type instance from any Scope
Avoid an overly verbose default error on a missing key for a complex object
const MyType = type({
foo: {
/** Some very complex object */
}
})
// previously threw with a message like:
// sections must be /* Some very complex description */ (was missing)
// now throws with a message like:
// sections must be an object (was missing)
MyType.assert({})
@arktype/[email protected]
Patch Changes
- #1008
3957acd
Thanks @ssalbdivad! - Add a new defaultformat
subscope
[email protected]
Allow overriding builtin keywords
// all references to string in this scope now enforce minLength: 1
const $ = scope({
foo: {
// has minLength: 1
bar: "string"
},
string: schema({ domain: "string" }).constrain("minLength", 1)
})
// has minLength: 1
const s = $.type("string")
Fix a ParseError compiling certain morphs with cyclic inputs
Types like the following will now work:
const types = scope({
ArraySchema: {
"items?": "Schema"
},
Schema: "TypeWithKeywords",
TypeWithKeywords: "ArraySchema"
}).export()
const t = types.Schema.pipe(o => JSON.stringify(o))
@arktype/[email protected]
Patch Changes
-
#1004
bf85e7d
Thanks @ssalbdivad! - (see arktype CHANGELOG)Allow overriding builtin keywords
Fix a ParseError compiling certain morphs with cyclic inputs
Rename RegexNode to PatternNode
@arktype/[email protected]
Patch Changes
- #999
21c0105
Thanks @ssalbdivad! - Fix chained .describe() on union types (see arktype CHANGELOG)
[email protected]
Fix chained .describe() on union types
// now correctly adds the description to the union and its branches
const t = type("number|string").describe("My custom type")