Releases: arktypeio/arktype
@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")
@arktype/[email protected]
Patch Changes
- #997
232fc42
Thanks @ssalbdivad! -
@arktype/[email protected]
Patch Changes
-
#997
232fc42
Thanks @ssalbdivad! - Add a newparseAsSchema
API that acceptsunknown
and returns either aParseError
or a Root schema instance with a castable parameter.Useful for stuff like:
const s = schema("number") const fromSerialized = parseAsSchema(s.json)
-
Updated dependencies [
232fc42
]:- @arktype/[email protected]