fix(deps): update dependency arktype to v2.1.20 #1803
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
2.0.0-dev.12-cjs->2.1.20Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
arktypeio/arktype (arktype)
v2.1.20Compare Source
toJsonSchemaconfigSome ArkType features don't have JSON Schema equivalents. By default,
toJsonSchema()will throw in these cases.This behavior can be configured granularly to match your needs.
a
defaulthandler can also be specified at the root of afallbackconfig:These options can also be set at a global or scope-level.
Fallback Codes
This is the full list of configurable reasons
toJsonSchema()can fail.arrayObjectarrayPostfixdefaultValuedomainbigintorsymbol)morphpatternIntersectionpredicateprotoinstanceofsymbolKeyunit===reference (e.g.undefined)dateprotofor Dates )cyclic types can now be converted to JSON Schema
temporarily disable discrimination for cyclic unions
This addresses multiple issues while we work on a permanent solution for accurately discriminating cyclic unions, tracked here.
addresses inference issues on some n-ary APIs like
type.oroutside the default scope (see the PR- thanks @simonwkla) 🎊v2.1.19Compare Source
Multiple improvements to
toJsonSchema()output, aligning it more closely with Open API standards.Faster completion triggers for shallow string definitions
This isn't actually an overall perf improvement, but just a language server optimization to trigger autocomplete sooner.
Counterintuitively, in previous 2.x versions, strings that are part of an object definition trigger completions much faster than shallow strings.
v2.1.18Compare Source
Fix an issue causing metatypes like
DefaultandOutto not be extracted from some recursive definitions:v2.1.17Compare Source
Unsatisfiable types for index signature intersections will now result in a
ParseErrorthanks to the work of @TizzySaurus on the upcoming@ark/json-schemapackage 🎉v2.1.16Compare Source
Fix an issue causing non-serializable error config to lead to incorrect error messages in some JIT-mode cases:
Added a workaround for environments where global prototypes like
FormDatahave degenerate resolutions like{}(currently the case in@types/bun, see https://github.com/oven-sh/bun/issues/18689)v2.1.15Compare Source
.configure({}, selector)fixesWith the much more powerful
.configure+ selector API now available, the internal.withMetamethod was removed as it can be trivially achieved via a self-selector:v2.1.14Compare Source
improve .expression for regex constraints
v2.1.13Compare Source
Add standalone functions for n-ary operators
v2.1.12Compare Source
exactOptionalPropertyTypesBy default, ArkType validates optional keys as if TypeScript's
exactOptionalPropertyTypesis set totrue.This approach allows the most granular control over optionality, as
| undefinedcan be added to properties that should accept it.However, if you have not enabled TypeScript's
exactOptionalPropertyTypessetting, you may globally configure ArkType'sexactOptionalPropertyTypestofalseto match TypeScript's behavior. If you do this, we'd recommend making a plan to enableexactOptionalPropertyTypesin the future.WARNING: exactOptionalPropertyTypes does not yet affect default values!
Support for this is tracked as part of this broader configurable defaultability issue.
v2.1.11Compare Source
selectmethod directly onType(previously was only available on.internal)v2.1.10Compare Source
Added a new
selectmethod for introspecting references of a node:NOTE:
@ark/schema's API is not semver stable, so this API may change slightly over time (though we will try to ensure it doesn't).These selectors can also be used to select references for configuration:
ArkErrorsare now JSON stringifiable and have two new props:flatByPathandflatProblemsByPath.v2.1.9Compare Source
The
|>operator pipes output to another Type parsed from a definition.It is now string-embeddable:
v2.1.8Compare Source
string.hex(thanks @HoaX7 - #1351)v2.1.7Compare Source
Address a rare crash on an invalid ctx reference in some jitless cases
Closes #1346
v2.1.6Compare Source
Improve some type-level parse errors on expressions with invalid finalizers
v2.1.5Compare Source
Fix JSDoc and go-to definition for unparsed keys
Addresses #1294
v2.1.4Compare Source
Static hermes compatibility (#1027)
v2.1.3Compare Source
Fix a jitless-mode bug causing default +
onUndeclaredKeytransformations to not apply (#1335)v2.1.2Compare Source
toJsonSchemaconfigSome ArkType features don't have JSON Schema equivalents. By default,
toJsonSchema()will throw in these cases.This behavior can be configured granularly to match your needs.
a
defaulthandler can also be specified at the root of afallbackconfig:These options can also be set at a global or scope-level.
Fallback Codes
This is the full list of configurable reasons
toJsonSchema()can fail.arrayObjectarrayPostfixdefaultValuedomainbigintorsymbol)morphpatternIntersectionpredicateprotoinstanceofsymbolKeyunit===reference (e.g.undefined)dateprotofor Dates )cyclic types can now be converted to JSON Schema
temporarily disable discrimination for cyclic unions
This addresses multiple issues while we work on a permanent solution for accurately discriminating cyclic unions, tracked here.
addresses inference issues on some n-ary APIs like
type.oroutside the default scope (see the PR- thanks @simonwkla) 🎊v2.1.1Compare Source
Multiple improvements to
toJsonSchema()output, aligning it more closely with Open API standards.Faster completion triggers for shallow string definitions
This isn't actually an overall perf improvement, but just a language server optimization to trigger autocomplete sooner.
Counterintuitively, in previous 2.x versions, strings that are part of an object definition trigger completions much faster than shallow strings.
v2.1.0Compare Source
matchThe
matchfunction provides a powerful way to handle different types of input and return corresponding outputs based on the input type, like a type-safeswitchstatement.Case Record API
The simplest way to define a matcher is with ArkType definition strings as keys with corresponding handlers as values:
In this example,
sizeOfis a matcher that takes a string, array, number, or bigint as input. It returns the length of strings and arrays, and the value of numbers and bigints.defaultaccepts one of 4 values:"assert": acceptunknown, throw if none of the cases match"never": accept an input based on inferred cases, throw if none match"reject": acceptunknown, returnArkErrorsif none of the cases match(data: In) => unknown: handle data not matching other cases directlyCases will be checked in the order they are specified, either as object literal keys or via chained methods.
Fluent API
The
matchfunction also provides a fluent API. This can be convenient for non-string-embeddable definitions:Narrowing input with
in, property matching withatSpecial thanks to @thetayloredman who did a mind-blowingly good job helping us iterate toward the current type-level pattern-matching implementation🙇
Built-in keywords can now be globally configured
This can be very helpful for customizing error messages without needing to create your own aliases or wrappers.
The options you can provide here are identical to those used to configure a Type directly, and can also be extended at a type-level to include custom metadata.
Tuple and args expressions for
.toIf a morph returns an
ArkErrorsinstance, validation will fail with that result instead of it being treated as a value. This is especially useful for using other Types as morphs to validate output or chain transformations.To make this easier, there's a special
tooperator that can pipe to a parsed definition without having to wrap it intypeto make it a function.This was added before 2.0, but now it comes with a corresponding operator (
|>) so that it can be expressed via a tuple or args like most other expressions:Error configurations now accept a string directly
Keep in mind, as mentioned in the docs, error configs like
messagecan clobber more granular config options likeexpectedandactualand cannot be included in composite errors e.g. for a union.Though generally, returning a string based on context is the best option, in situations where you always want the same static message, it's now easier to get that!
Type.toString() now wraps its syntactic representation in
Type<..>Previously,
Type.toString()just returnedType.expression. However, in contexts where the source of a message isn't always aType, it could be confusing:Hopefully if you interpolate a Type, you'll be less confused by the result from now on!
Improve how Type instances are inferred when wrapped in external generics
Previously, we used
NoInferin some Type method returns. After migrating those to inlined conditionals, we get the same benefit and external inference for cases like this is more reliable:Fix an issue causing some discriminated unions to incorrectly reject default cases
v2.0.4Compare Source
Fix an issue causing global configs to be overwritten when the primary
"arktype"entry point is imported:config.tsmain.tsPrevious versions of the docs mistakenly suggested this was possible in a single file. This is not the case in ESM due to hoisting. See the updated global configuration docs here.
Better
ParseErrorwhen attempting to constraint a morphPreviously, attempting to directly constrain a transformed type was not a type error but gave a confusing error at runtime:
We've added a type error and improved the runtime error:
Fix an issue causing certain complex morph types to not infer output correctly, e.g.:
v2.0.3Compare Source
Fix an issue causing some unions with
onUndeclaredKey: "reject"to reject valid data (#1266)Fix an issue where Types containing arrays were incorrectly treated as including morphs, leading to some unnecessary validation overhead (#1268)
Fix an issue causing objects containing functions like
() => neverthat are subtypes ofInferredMorphto be incorrectly treated as morphs (#1264)Fail early with a
ParseErrorifinstanceOfoperand is not actually a function at runtime (#1262)v2.0.2Compare Source
numberAllowsNan,dateAllowsInvalidandonUndeclaredKey) could be specified at a scope-level, leading to unintuitive cache results (#1255)v2.0.1Compare Source
@ark/utilversion specifierv2.0.0Compare Source
v2.0.0-rc.33Compare Source
v2.0.0-rc.32Compare Source
v2.0.0-rc.31Compare Source
v2.0.0-rc.30Compare Source
v2.0.0-rc.29Compare Source
v2.0.0-rc.28Compare Source
v2.0.0-rc.27Compare Source
v2.0.0-rc.26Compare Source
v2.0.0-rc.25Compare Source
v2.0.0-rc.24Compare Source
v2.0.0-rc.23Compare Source
v2.0.0-rc.22Compare Source
v2.0.0-rc.21Compare Source
v2.0.0-rc.18Compare Source
v2.0.0-rc.17Compare Source
v2.0.0-rc.16Compare Source
v2.0.0-rc.15Compare Source
v2.0.0-rc.14Compare Source
v2.0.0-rc.13Compare Source
v2.0.0-rc.12Compare Source
v2.0.0-rc.11Compare Source
v2.0.0-rc.10Compare Source
v2.0.0-rc.9Compare Source
v2.0.0-rc.8Compare Source
v2.0.0-rc.7Compare Source
v2.0.0-rc.6Compare Source
v2.0.0-rc.5Compare Source
v2.0.0-rc.4Compare Source
v2.0.0-rc.3Compare Source
v2.0.0-rc.2Compare Source
v2.0.0-rc.1Compare Source
v2.0.0-rc.0Compare Source
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.