UnexpectedKeyRepresents a schema issue produced when an input object or tuple contains a key/index not declared by the schema.
When to use
Use when you need to detect excess properties during strict struct/tuple validation.
Details
actualis the raw value at the unexpected key (plainunknown).astis the schema that was being validated against.annotationsonastmay contain a custommessageUnexpectedKey.
export class class UnexpectedKeyclass UnexpectedKey {
_tag: 'UnexpectedKey';
ast: SchemaAST.AST;
actual: unknown;
toString: (this: Issue) => string;
}
Represents a schema issue produced when an input object or tuple contains a key/index not
declared by the schema.
When to use
Use when you need to detect excess properties during strict struct/tuple
validation.
Details
actual is the raw value at the unexpected key (plain unknown).
ast is the schema that was being validated against.
annotations on ast may contain a custom messageUnexpectedKey.
UnexpectedKey extends class BaseBase {
readonly UnexpectedKey._tag: "UnexpectedKey"_tag = "UnexpectedKey"
/**
* The schema that caused the issue.
*/
readonly UnexpectedKey.ast: SchemaAST.ASTThe schema that caused the issue.
ast: import SchemaASTSchemaAST.type AST = SchemaAST.Declaration | SchemaAST.Null | SchemaAST.Undefined | SchemaAST.Void | SchemaAST.Never | SchemaAST.Unknown | SchemaAST.Any | SchemaAST.String | SchemaAST.Number | SchemaAST.Boolean | SchemaAST.BigInt | SchemaAST.Symbol | SchemaAST.Literal | SchemaAST.UniqueSymbol | SchemaAST.ObjectKeyword | SchemaAST.Enum | SchemaAST.TemplateLiteral | SchemaAST.Arrays | SchemaAST.Objects | SchemaAST.Union<...> | SchemaAST.SuspendDiscriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST
/**
* The input value that caused the issue.
*/
readonly UnexpectedKey.actual: unknownThe input value that caused the issue.
actual: unknown
constructor(
/**
* The schema that caused the issue.
*/
ast: SchemaAST.ASTThe schema that caused the issue.
ast: import SchemaASTSchemaAST.type AST = SchemaAST.Declaration | SchemaAST.Null | SchemaAST.Undefined | SchemaAST.Void | SchemaAST.Never | SchemaAST.Unknown | SchemaAST.Any | SchemaAST.String | SchemaAST.Number | SchemaAST.Boolean | SchemaAST.BigInt | SchemaAST.Symbol | SchemaAST.Literal | SchemaAST.UniqueSymbol | SchemaAST.ObjectKeyword | SchemaAST.Enum | SchemaAST.TemplateLiteral | SchemaAST.Arrays | SchemaAST.Objects | SchemaAST.Union<...> | SchemaAST.SuspendDiscriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST,
/**
* The input value that caused the issue.
*/
actual: unknownThe input value that caused the issue.
actual: unknown
) {
super()
this.UnexpectedKey.ast: SchemaAST.ASTThe schema that caused the issue.
ast = ast: SchemaAST.ASTThe schema that caused the issue.
ast
this.UnexpectedKey.actual: unknownThe input value that caused the issue.
actual = actual: unknownThe input value that caused the issue.
actual
}
}