Skip to main content

Class: VObject<Type, Fields, IsOptional, FieldPaths>

values.VObject

The type of the v.object() validator.

Type parameters

NameType
TypeType
Fieldsextends Record<string, GenericValidator>
IsOptionalextends OptionalProperty = "required"
FieldPathsextends string = { [Property in keyof Fields]: JoinFieldPaths<Property & string, Fields[Property]["fieldPaths"]> | Property }[keyof Fields] & string

Hierarchy

  • BaseValidator<Type, IsOptional, FieldPaths>

    VObject

Constructors

constructor

new VObject<Type, Fields, IsOptional, FieldPaths>(«destructured»)

Usually you'd use v.object({ ... }) instead.

Type parameters

NameType
TypeType
Fieldsextends Record<string, GenericValidator>
IsOptionalextends OptionalProperty = "required"
FieldPathsextends string = { [Property in string | number | symbol]: Property | `${Property & string}.${Fields[Property]["fieldPaths"]}` }[keyof Fields] & string

Parameters

NameType
«destructured»Object
› isOptionalIsOptional
› fieldsFields

Overrides

BaseValidator&lt;Type, IsOptional, FieldPaths&gt;.constructor

Defined in

values/validators.ts:289

Properties

type

Readonly type: Type

Only for TypeScript, the TS type of the JS values validated by this validator.

Inherited from

BaseValidator.type

Defined in

values/validators.ts:21


fieldPaths

Readonly fieldPaths: FieldPaths

Only for TypeScript, if this an Object validator, then this is the TS type of its property names.

Inherited from

BaseValidator.fieldPaths

Defined in

values/validators.ts:26


isOptional

Readonly isOptional: IsOptional

Whether this is an optional Object property value validator.

Inherited from

BaseValidator.isOptional

Defined in

values/validators.ts:31


isConvexValidator

Readonly isConvexValidator: true

Always "true".

Inherited from

BaseValidator.isConvexValidator

Defined in

values/validators.ts:36


fields

Readonly fields: Fields

An object with the validator for each property.

Defined in

values/validators.ts:279


kind

Readonly kind: "object"

The kind of validator, "object".

Defined in

values/validators.ts:284

Accessors

optional

get optional(): boolean

Deprecated

  • use isOptional instead

Returns

boolean

Inherited from

BaseValidator.optional

Defined in

values/validators.ts:43