Skip to content

Any

@tsed/schema

Usage

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

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

Overview

ts
function Any(...types: (JSONSchema6TypeName | Type<any> | any)[]): (...args: any[]) => any;

Description

Set the type of the array items.

Example

typescript
class Model {
   @Any()
   property: any;

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

Will produce:

json
{
  "type": "object",
  "properties": {
    "property": {
      "type": ["integer", "number", "string", "boolean", "array", "object", "null"]
    }
  }
}

Released under the MIT License.