Function: isArgsValidationError()
Check whether an error is an ArgsValidationError.
Prefer this over the args-tokens guard of the same name. Both recognize errors from another bundled copy through the Symbol.for('args-tokens.ArgsValidationError') brand that args-tokens 0.29.0 or later sets, including subclasses such as ArgResolveError that override name with the argument name. This guard additionally:
- recognizes direct
ArgsValidationErrorinstances from copies bundlingargs-tokensolder than 0.29.0, which do not set the brand - checks that
codeandvaluesof an error from another copy have the expected types
The guard narrows only to ArgsValidationError: across copies, instanceof ArgResolveError still fails, so do not rely on type or schema for such errors.
Signature
ts
export function isArgsValidationError(error: unknown): error is ArgsValidationErrorParameters
| Name | Type | Description |
|---|---|---|
error | unknown | An unknown error |
Returns
error is ArgsValidationError — true if the error is an ArgsValidationError
