Skip to content

Nullable

@tsed/schema

Usage

typescript
import { Nullable } from "@tsed/schema";

See /packages/specs/schema/src/types/decorators/common/nullable.ts.

Overview

ts
function Nullable(type: JSONSchema6TypeName | Type<any> | any, ...types: (JSONSchema6TypeName | Type<any> | any)[]): any;

Description

Set field as nullable.

Example

typescript
class Model {
   @Nullable(Date)
   property: Date | null;

   @Nullable(String, Number, Boolean)
   property: string | number | boolean | null;
}

Released under the MIT License.