fix(deps): update dependency arktype to v2.1.0 #1682
                
     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.0Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
arktypeio/arktype (arktype)
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 withatBuiltin 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
"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.
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:
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.