Skip to content

LabelledAs

@tsed/schema

Usage

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

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

Overview

ts
function LabelledAs(label: string, includeCollection?: false | "collection"): PropertyDecorator;
  • label (string): The name of the label

  • includeCollection (false | "collection"): Optional. Add the label to the collection. By default, the label is added to the item of the collection it the property is a collection.

Description

Use label to create ref on the current decorated property.

Example

ts
class Model {
  // For single property
LabelledAs("UserSchema")
  name: string;

  // For collection
LabelledAs("UserCollectionSchema", "collection")
  users: User[];
}

Released under the MIT License.