---
title: "TypeBoxValidator"
description: "Elysia API reference for TypeBoxValidator."
url: "https://next.elysiajs.com/reference/classes/typeboxvalidator/"
---

# TypeBoxValidator

## Members

### Properties

| Property                                                                      | Description |
| ----------------------------------------------------------------------------- | ----------- |
| [Clean](/reference/classes/typeboxvalidator/#clean)                           | -           |
| [hasCodec](/reference/classes/typeboxvalidator/#hascodec)                     | -           |
| [hasDefault](/reference/classes/typeboxvalidator/#hasdefault)                 | -           |
| [isAsync](/reference/classes/typeboxvalidator/#isasync)                       | -           |
| [mayReturnPromise](/reference/classes/typeboxvalidator/#mayreturnpromise)     | -           |
| [precomputeSafe](/reference/classes/typeboxvalidator/#precomputesafe)         | -           |
| [reconstructedCheck](/reference/classes/typeboxvalidator/#reconstructedcheck) | -           |
| [schema](/reference/classes/typeboxvalidator/#schema)                         | -           |
| [tb](/reference/classes/typeboxvalidator/#tb)                                 | -           |

### Methods

| Method                                                              | Description |
| ------------------------------------------------------------------- | ----------- |
| [Check](/reference/classes/typeboxvalidator/#check)                 | -           |
| [Decode](/reference/classes/typeboxvalidator/#decode)               | -           |
| [Encode](/reference/classes/typeboxvalidator/#encode)               | -           |
| [EncodeFrom](/reference/classes/typeboxvalidator/#encodefrom)       | -           |
| [Errors](/reference/classes/typeboxvalidator/#errors)               | -           |
| [From](/reference/classes/typeboxvalidator/#from)                   | -           |
| [FromAsync](/reference/classes/typeboxvalidator/#fromasync)         | -           |
| [FromSync](/reference/classes/typeboxvalidator/#fromsync)           | -           |
| [clear](/reference/classes/typeboxvalidator/#clear)                 | -           |
| [create](/reference/classes/typeboxvalidator/#create)               | -           |
| [isAsyncMember](/reference/classes/typeboxvalidator/#isasyncmember) | -           |
| [reference](/reference/classes/typeboxvalidator/#reference)         | -           |
| [response](/reference/classes/typeboxvalidator/#response)           | -           |

Defined in: elysia/dist/type/validator/index.d.ts:11

## Extends

- [`Validator`](/reference/classes/validator/)

## Type Parameters

| Type Parameter          | Default type |
| ----------------------- | ------------ |
| `T` *extends* `TSchema` | `TAny`       |

## Constructors

### Constructor

```ts
new TypeBoxValidator<T>(
   schema,
   options?,
   name?,
   isIntersectable?
): TypeBoxValidator<T>;
```

Defined in: elysia/dist/type/validator/index.d.ts:21

#### Parameters

| Parameter          | Type               |
| ------------------ | ------------------ |
| `schema`           | `T`                |
| `options?`         | `ValidatorOptions` |
| `name?`            | `string`           |
| `isIntersectable?` | `boolean`          |

#### Returns

`TypeBoxValidator`<`T`>

#### Overrides

[`Validator`](/reference/classes/validator/).[`constructor`](/reference/classes/validator/#constructor)

## Properties

### Clean

```ts
Clean: (value) => unknown;
```

Defined in: elysia/dist/validator/index.d.ts:37

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `value`   | `unknown` |

#### Returns

`unknown`

#### Inherited from

[`Validator`](/reference/classes/validator/).[`Clean`](/reference/classes/validator/#clean)

***

### hasCodec

```ts
hasCodec: boolean;
```

Defined in: elysia/dist/type/validator/index.d.ts:17

***

### hasDefault

```ts
hasDefault: boolean;
```

Defined in: elysia/dist/type/validator/index.d.ts:19

***

### isAsync

```ts
isAsync: boolean;
```

Defined in: elysia/dist/type/validator/index.d.ts:18

#### Overrides

[`Validator`](/reference/classes/validator/).[`isAsync`](/reference/classes/validator/#isasync)

***

### mayReturnPromise

```ts
mayReturnPromise: boolean;
```

Defined in: elysia/dist/validator/index.d.ts:32

#### Inherited from

[`Validator`](/reference/classes/validator/).[`mayReturnPromise`](/reference/classes/validator/#mayreturnpromise)

***

### precomputeSafe

```ts
precomputeSafe: boolean;
```

Defined in: elysia/dist/type/validator/index.d.ts:20

***

### reconstructedCheck?

```ts
optional reconstructedCheck?: (value) => boolean;
```

Defined in: elysia/dist/type/validator/index.d.ts:15

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `value`   | `unknown` |

#### Returns

`boolean`

***

### schema

```ts
schema: T;
```

Defined in: elysia/dist/type/validator/index.d.ts:16

***

### tb?

```ts
optional tb?: Validator;
```

Defined in: elysia/dist/type/validator/index.d.ts:14

## Methods

### Check()

```ts
Check(value): boolean;
```

Defined in: elysia/dist/type/validator/index.d.ts:22

#### Parameters

| Parameter | Type              |
| --------- | ----------------- |
| `value`   | `StaticType`<\[]> |

#### Returns

`boolean`

#### Overrides

[`Validator`](/reference/classes/validator/).[`Check`](/reference/classes/validator/#check)

***

### Decode()

```ts
Decode(value): StaticType<[]>;
```

Defined in: elysia/dist/type/validator/index.d.ts:24

#### Parameters

| Parameter | Type              |
| --------- | ----------------- |
| `value`   | `StaticType`<\[]> |

#### Returns

`StaticType`<\[]>

***

### Encode()

```ts
Encode(value): StaticType<[]>;
```

Defined in: elysia/dist/type/validator/index.d.ts:25

#### Parameters

| Parameter | Type              |
| --------- | ----------------- |
| `value`   | `StaticType`<\[]> |

#### Returns

`StaticType`<\[]>

***

### EncodeFrom()

```ts
EncodeFrom(value, type?): StaticType<[]>;
```

Defined in: elysia/dist/type/validator/index.d.ts:26

#### Parameters

| Parameter | Type              |
| --------- | ----------------- |
| `value`   | `StaticType`<\[]> |
| `type?`   | `string`          |

#### Returns

`StaticType`<\[]>

***

### Errors()

```ts
Errors(value): TLocalizedValidationError[];
```

Defined in: elysia/dist/type/validator/index.d.ts:23

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `value`   | `unknown` |

#### Returns

`TLocalizedValidationError`\[]

#### Overrides

[`Validator`](/reference/classes/validator/).[`Errors`](/reference/classes/validator/#errors)

***

### From()

```ts
From(value, type?): MaybePromise<StaticType<[], "Encode", {
}, {
}, T>>;
```

Defined in: elysia/dist/type/validator/index.d.ts:27

#### Parameters

| Parameter | Type              |
| --------- | ----------------- |
| `value`   | `StaticType`<\[]> |
| `type?`   | `string`          |

#### Returns

`MaybePromise`<`StaticType`<\[], `"Encode"`, { }, { }, `T`>>

#### Overrides

[`Validator`](/reference/classes/validator/).[`From`](/reference/classes/validator/#from)

***

### FromAsync()

```ts
FromAsync(value, type?): Promise<StaticType<[], "Encode", {
}, {
}, T>>;
```

Defined in: elysia/dist/type/validator/index.d.ts:29

#### Parameters

| Parameter | Type              |
| --------- | ----------------- |
| `value`   | `StaticType`<\[]> |
| `type?`   | `string`          |

#### Returns

`Promise`<`StaticType`<\[], `"Encode"`, { }, { }, `T`>>

***

### FromSync()

```ts
FromSync(value, type?): StaticType<[]>;
```

Defined in: elysia/dist/type/validator/index.d.ts:30

#### Parameters

| Parameter | Type              |
| --------- | ----------------- |
| `value`   | `StaticType`<\[]> |
| `type?`   | `string`          |

#### Returns

`StaticType`<\[]>

***

### clear()

```ts
static clear(): void;
```

Defined in: elysia/dist/validator/index.d.ts:42

#### Returns

`void`

#### Inherited from

[`Validator`](/reference/classes/validator/).[`clear`](/reference/classes/validator/#clear)

***

### create()

#### Call Signature

```ts
static create<Schema>(schema, options?): TypeBoxValidator<Schema>;
```

Defined in: elysia/dist/validator/index.d.ts:38

##### Type Parameters

| Type Parameter               |
| ---------------------------- |
| `Schema` *extends* `TSchema` |

##### Parameters

| Parameter  | Type               |
| ---------- | ------------------ |
| `schema`   | `Schema`           |
| `options?` | `ValidatorOptions` |

##### Returns

`TypeBoxValidator`<`Schema`>

##### Inherited from

[`Validator`](/reference/classes/validator/).[`create`](/reference/classes/validator/#create)

#### Call Signature

```ts
static create<Schema>(schema, options?): StandardValidator;
```

Defined in: elysia/dist/validator/index.d.ts:39

##### Type Parameters

| Type Parameter                                                                                                 |
| -------------------------------------------------------------------------------------------------------------- |
| `Schema` *extends* [`StandardSchemaV1Like`](/reference/interfaces/standardschemav1like/)<`unknown`, `unknown`> |

##### Parameters

| Parameter  | Type               |
| ---------- | ------------------ |
| `schema`   | `Schema`           |
| `options?` | `ValidatorOptions` |

##### Returns

[`StandardValidator`](/reference/classes/standardvalidator/)

##### Inherited from

[`Validator`](/reference/classes/validator/).[`create`](/reference/classes/validator/#create)

#### Call Signature

```ts
static create(schema, options?): Validator;
```

Defined in: elysia/dist/validator/index.d.ts:40

##### Parameters

| Parameter  | Type               |
| ---------- | ------------------ |
| `schema`   | `null`             |
| `options?` | `ValidatorOptions` |

##### Returns

[`Validator`](/reference/classes/validator/)

##### Inherited from

[`Validator`](/reference/classes/validator/).[`create`](/reference/classes/validator/#create)

***

### isAsyncMember()

```ts
static isAsyncMember(schema, compiled): boolean;
```

Defined in: elysia/dist/type/validator/index.d.ts:13

#### Parameters

| Parameter  | Type      |
| ---------- | --------- |
| `schema`   | `TSchema` |
| `compiled` | `any`     |

#### Returns

`boolean`

***

### reference()

```ts
static reference(schema, models): AnySchema;
```

Defined in: elysia/dist/validator/index.d.ts:35

#### Parameters

| Parameter | Type                                                                                                                    |
| --------- | ----------------------------------------------------------------------------------------------------------------------- |
| `schema`  | \| `string` \| `TSchema` \| [`StandardSchemaV1Like`](/reference/interfaces/standardschemav1like/)<`unknown`, `unknown`> |
| `models`  | `Record`<`string` \| `number` \| `symbol`, [`AnySchema`](/reference/type-aliases/anyschema/)>                           |

#### Returns

[`AnySchema`](/reference/type-aliases/anyschema/)

#### Inherited from

[`Validator`](/reference/classes/validator/).[`reference`](/reference/classes/validator/#reference)

***

### response()

```ts
static response(schema, options?): Map<number, Validator>;
```

Defined in: elysia/dist/validator/index.d.ts:41

#### Parameters

| Parameter  | Type                                                                                                                                                                                                                                           |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `schema`   | \| `TSchema` \| [`StandardSchemaV1Like`](/reference/interfaces/standardschemav1like/)<`unknown`, `unknown`> \| `Record`<`number`, \| `TSchema` \| [`StandardSchemaV1Like`](/reference/interfaces/standardschemav1like/)<`unknown`, `unknown`>> |
| `options?` | `ResponseValidatorOptions`                                                                                                                                                                                                                     |

#### Returns

`Map`<`number`, [`Validator`](/reference/classes/validator/)>

#### Inherited from

[`Validator`](/reference/classes/validator/).[`response`](/reference/classes/validator/#response)
