Skip to main content
values.VObject The type of the v.object() validator.

Type parameters

Hierarchy

  • BaseValidator<Type, IsOptional, FieldPaths> ↳ VObject

Constructors

constructor

• new VObject<Type, Fields, IsOptional, FieldPaths>(«destructured») Usually you’d use v.object({ ... }) instead.

Type parameters

Parameters

Overrides

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

Properties

type

• Readonly type: Type Only for TypeScript, the TS type of the JS values validated by this validator.

Inherited from

BaseValidator.type

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

isOptional

• Readonly isOptional: IsOptional Whether this is an optional Object property value validator.

Inherited from

BaseValidator.isOptional

isBijectionValidator

• Readonly isBijectionValidator: true Always "true".

Inherited from

BaseValidator.isBijectionValidator

fields

• Readonly fields: Fields An object with the validator for each property.

kind

• Readonly kind: "object" The kind of validator, "object".

Methods

optional

▸ optional(): VObject<undefined | Type, Fields, "optional", FieldPaths> Allow this validated field to be absent.

Returns

VObject<undefined | Type, Fields, "optional", FieldPaths>

Overrides

BaseValidator.optional

omit

▸ omit<K>(...fields): VObject<Expand<Omit<Type, K>>, Expand<Omit<Fields, K>>, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{Expand<Omit<Fields, K>>[Property][“fieldPaths”]}` }[keyof Expand<Omit<Fields, K>>] & string> Create a new VObject with the specified fields omitted.

Type parameters

Parameters

Returns

VObject<Expand<Omit<Type, K>>, Expand<Omit<Fields, K>>, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{Expand<Omit<Fields, K>>[Property][“fieldPaths”]}` }[keyof Expand<Omit<Fields, K>>] & string>

pick

▸ pick<K>(...fields): VObject<Expand<Pick<Type, Extract<keyof Type, K>>>, Expand<Pick<Fields, K>>, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{Expand<Pick<Fields, K>>[Property][“fieldPaths”]}` }[keyof Expand<Pick<Fields, K>>] & string> Create a new VObject with only the specified fields.

Type parameters

Parameters

Returns

VObject<Expand<Pick<Type, Extract<keyof Type, K>>>, Expand<Pick<Fields, K>>, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{Expand<Pick<Fields, K>>[Property][“fieldPaths”]}` }[keyof Expand<Pick<Fields, K>>] & string>

partial

▸ partial(): VObject<{ [K in string | number | symbol]?: Type[K] }, { [K in string | number | symbol]: VOptional<Fields[K]> }, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{{ [K in string | number | symbol]: VOptional<Fields[K]> }[Property][“fieldPaths”]}` }[keyof Fields] & string> Create a new VObject with all fields marked as optional.

Returns

VObject<{ [K in string | number | symbol]?: Type[K] }, { [K in string | number | symbol]: VOptional<Fields[K]> }, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{{ [K in string | number | symbol]: VOptional<Fields[K]> }[Property][“fieldPaths”]}` }[keyof Fields] & string>

extend

▸ extend<NewFields>(fields): VObject<Expand<Type & ObjectType<NewFields>>, Expand<Fields & NewFields>, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{Expand<Fields & NewFields>[Property][“fieldPaths”]}` }[keyof Expand<Fields & NewFields>] & string> Create a new VObject with additional fields merged in.

Type parameters

Parameters

Returns

VObject<Expand<Type & ObjectType<NewFields>>, Expand<Fields & NewFields>, IsOptional, { [Property in string | number | symbol]: Property | `\{Property & string}.{Expand<Fields & NewFields>[Property][“fieldPaths”]}` }[keyof Expand<Fields & NewFields>] & string>