ObjectValidator
Table of contents
Public class
Signature
class ObjectValidator<Shape extends object> extends Validator<Shape> {}
References
Source
packages/validate/src/lib/validation.ts
Constructor
Public constructor
Constructs a new instance of the ObjectValidator
class
Parameters
Name | Description |
---|---|
|
|
|
|
References
Properties
config
Public readonly property
Signature
readonly config: {
readonly [K in keyof Shape]: Validatable<Shape[K]>
}
References
Methods
allowUnknownProperties()
Public method
Signature
allowUnknownProperties(): ObjectValidator<Shape>
References
extend()
Public method
Extend an object validator by adding additional properties.
Example
const animalValidator = T.object({
name: T.string,
})
const catValidator = animalValidator.extend({
meowVolume: T.number,
})
Signature
extend<Extension extends Record<string, unknown>>(extension: {
readonly [K in keyof Extension]: Validatable<Extension[K]>
}): ObjectValidator<Shape & Extension>
Parameters
Name | Description |
---|---|
|
|
Returns
ObjectValidator<Shape & Extension>
References