# EntityDescription Class

Module
import { EntityDescription } from "@tsed/core"
Source/packages/core/src/class/EntityDescription.ts

# Overview

abstract class EntityDescription {
    protected _target: Type<any>;
    name: string;
    readonly index: number;
    readonly propertyKey: string | symbol;
    collectionType: Type<any>;
    required: boolean;
    allowedRequiredValues: any[];
    protected _type: Type<any>;
    constructor(_target: Type<any>, propertyKey: string | symbol, index?: number | PropertyDescriptor);
    get target(): Type<any>;
    set target(target: Type<any>);
    get targetName(): string;
    get type(): Type<any>;
    set type(value: Type<any>);
    get typeName(): string;
    get collectionName(): string;
    get isCollection(): boolean;
    get isArray(): boolean;
    get isPrimitive(): boolean;
    get isDate(): boolean;
    get isObject(): boolean;
    get isClass(): boolean;
    isRequired(value: any): boolean;
}

# Description

EntityDescription store all information collected by a decorator (class, property key and in option the index of the parameters).

# Members

protected _target: Type<any>

name: string

Custom name.


readonly index: number

Index of the entity. Only used when the entity describe a parameters.


readonly propertyKey: string | symbol

collectionType: Type<any>

Type of the collection (Array, Map, Set, etc...)


required: boolean

Required entity.


allowedRequiredValues: any[]

Allowed value when the entity is required.


protected _type: Type<any>

Type of the entity.


get target(): Type<any>

Class of the entity.


set target(target: Type<any>)

get targetName(): string

Return the class name of the entity.


get type(): Type<any>

set type(value: Type<any>)

get typeName(): string

get collectionName(): string

get isCollection(): boolean

get isArray(): boolean

get isPrimitive(): boolean

get isDate(): boolean

get isObject(): boolean

get isClass(): boolean

isRequired(value: any): boolean

Check precondition between value, required and allowedRequiredValues to know if the entity is required.