> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

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

> The type of the v.object() validator.

[values](/api/modules/values).VObject

The type of the `v.object()` validator.

## Type parameters

| Name | Type |
| :- | :- |
| `Type` | `Type` |
| `Fields` | extends `Record`\<`string`, [`GenericValidator`](/api/modules/values#genericvalidator)> |
| `IsOptional` | extends [`OptionalProperty`](/api/modules/values#optionalproperty) = `"required"` |
| `FieldPaths` | extends `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

| Name | Type |
| :- | :- |
| `Type` | `Type` |
| `Fields` | extends `Record`\<`string`, [`GenericValidator`](/api/modules/values#genericvalidator)> |
| `IsOptional` | extends [`OptionalProperty`](/api/modules/values#optionalproperty) = `"required"` |
| `FieldPaths` | extends `string` = \{ \[Property in string \| number \| symbol]: Property \| \`$\{Property & string}.$\{Fields\[Property]\["fieldPaths"]}\` }\[keyof `Fields`] & `string` |

#### Parameters

| Name | Type |
| :- | :- |
| `«destructured»` | `Object` |
| › `isOptional` | `IsOptional` |
| › `fields` | `Fields` |

#### 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`](/api/classes/values.VObject)\<`undefined` | `Type`, `Fields`, `"optional"`, `FieldPaths`>

Allow this validated field to be absent.

#### Returns

[`VObject`](/api/classes/values.VObject)\<`undefined` | `Type`, `Fields`, `"optional"`, `FieldPaths`>

#### Overrides

BaseValidator.optional

***

### omit

▸ **omit**\<`K`>(`...fields`): [`VObject`](/api/classes/values.VObject)\<[`Expand`](/api/modules/server#expand)\<`Omit`\<`Type`, `K`>>, [`Expand`](/api/modules/server#expand)\<`Omit`\<`Fields`, `K`>>, `IsOptional`, \{ \[Property in string | number | symbol]: Property | \`$\{Property & string}.$\{Expand\<Omit\<Fields, K>>\[Property]\["fieldPaths"]}\` }\[keyof [`Expand`](/api/modules/server#expand)\<`Omit`\<`Fields`, `K`>>] & `string`>

Create a new VObject with the specified fields omitted.

#### Type parameters

| Name | Type |
| :- | :- |
| `K` | extends `string` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `...fields` | `K`\[] | The field names to omit from this VObject. |

#### Returns

[`VObject`](/api/classes/values.VObject)\<[`Expand`](/api/modules/server#expand)\<`Omit`\<`Type`, `K`>>, [`Expand`](/api/modules/server#expand)\<`Omit`\<`Fields`, `K`>>, `IsOptional`, \{ \[Property in string | number | symbol]: Property | \`$\{Property & string}.$\{Expand\<Omit\<Fields, K>>\[Property]\["fieldPaths"]}\` }\[keyof [`Expand`](/api/modules/server#expand)\<`Omit`\<`Fields`, `K`>>] & `string`>

***

### pick

▸ **pick**\<`K`>(`...fields`): [`VObject`](/api/classes/values.VObject)\<[`Expand`](/api/modules/server#expand)\<`Pick`\<`Type`, `Extract`\<keyof `Type`, `K`>>>, [`Expand`](/api/modules/server#expand)\<`Pick`\<`Fields`, `K`>>, `IsOptional`, \{ \[Property in string | number | symbol]: Property | \`$\{Property & string}.$\{Expand\<Pick\<Fields, K>>\[Property]\["fieldPaths"]}\` }\[keyof [`Expand`](/api/modules/server#expand)\<`Pick`\<`Fields`, `K`>>] & `string`>

Create a new VObject with only the specified fields.

#### Type parameters

| Name | Type |
| :- | :- |
| `K` | extends `string` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `...fields` | `K`\[] | The field names to pick from this VObject. |

#### Returns

[`VObject`](/api/classes/values.VObject)\<[`Expand`](/api/modules/server#expand)\<`Pick`\<`Type`, `Extract`\<keyof `Type`, `K`>>>, [`Expand`](/api/modules/server#expand)\<`Pick`\<`Fields`, `K`>>, `IsOptional`, \{ \[Property in string | number | symbol]: Property | \`$\{Property & string}.$\{Expand\<Pick\<Fields, K>>\[Property]\["fieldPaths"]}\` }\[keyof [`Expand`](/api/modules/server#expand)\<`Pick`\<`Fields`, `K`>>] & `string`>

***

### partial

▸ **partial**(): [`VObject`](/api/classes/values.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`](/api/classes/values.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`](/api/classes/values.VObject)\<[`Expand`](/api/modules/server#expand)\<`Type` & [`ObjectType`](/api/modules/values#objecttype)\<`NewFields`>>, [`Expand`](/api/modules/server#expand)\<`Fields` & `NewFields`>, `IsOptional`, \{ \[Property in string | number | symbol]: Property | \`$\{Property & string}.$\{Expand\<Fields & NewFields>\[Property]\["fieldPaths"]}\` }\[keyof [`Expand`](/api/modules/server#expand)\<`Fields` & `NewFields`>] & `string`>

Create a new VObject with additional fields merged in.

#### Type parameters

| Name | Type |
| :- | :- |
| `NewFields` | extends `Record`\<`string`, [`GenericValidator`](/api/modules/values#genericvalidator)> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `fields` | `NewFields` | An object with additional validators to merge into this VObject. |

#### Returns

[`VObject`](/api/classes/values.VObject)\<[`Expand`](/api/modules/server#expand)\<`Type` & [`ObjectType`](/api/modules/values#objecttype)\<`NewFields`>>, [`Expand`](/api/modules/server#expand)\<`Fields` & `NewFields`>, `IsOptional`, \{ \[Property in string | number | symbol]: Property | \`$\{Property & string}.$\{Expand\<Fields & NewFields>\[Property]\["fieldPaths"]}\` }\[keyof [`Expand`](/api/modules/server#expand)\<`Fields` & `NewFields`>] & `string`>
