# Class Entity

Class
Module
import { Entity } from "@tsed/core"
Source/packages/core/src/domain/Entity.ts

# Overview

abstract class Entity {
<span class="token keyword">readonly</span> propertyKey<span class="token punctuation">:</span> <span class="token keyword">string</span> | symbol<span class="token punctuation">;</span>

<span class="token keyword">readonly</span> propertyName<span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>

<span class="token keyword">readonly</span> index<span class="token punctuation">:</span> <span class="token keyword">number</span><span class="token punctuation">;</span>

<span class="token keyword">readonly</span> descriptor<span class="token punctuation">:</span> <span class="token keyword">number</span><span class="token punctuation">;</span>

<span class="token keyword">readonly</span> decoratorType<span class="token punctuation">:</span> <a href="/api/core/domain/DecoratorTypes.html"><span class="token">DecoratorTypes</span></a><span class="token punctuation">;</span>

collectionType<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
token<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>

<span class="token keyword">protected</span> _type<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
<span class="token keyword">protected</span> _target<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
<span class="token keyword">protected</span> <span class="token keyword">constructor</span><span class="token punctuation">(</span><span class="token punctuation">{</span> target<span class="token punctuation">,</span> propertyKey<span class="token punctuation">,</span> descriptor<span class="token punctuation">,</span> index <span class="token punctuation">}</span><span class="token punctuation">:</span> <a href="/api/core/domain/EntityOptions.html"><span class="token">EntityOptions</span></a><span class="token punctuation">)</span><span class="token punctuation">;</span>

get <span class="token function">target</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>

get <span class="token function">targetName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>

get <span class="token function">collectionName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>

get <span class="token function">type</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt; | <span class="token keyword">any</span><span class="token punctuation">;</span>

set <span class="token function">type</span><span class="token punctuation">(</span>value<span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt; | <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

get <span class="token function">typeName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">string</span><span class="token punctuation">;</span>

get <span class="token function">computedType</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/core/interfaces/Type.html"><span class="token">Type</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>

get <span class="token function">isCollection</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

get <span class="token function">isArray</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

get <span class="token function">isPrimitive</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

get <span class="token function">isDate</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

get <span class="token function">isObject</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

get <span class="token function">isClass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

}

# Members

readonly propertyKey: string | symbol;

Original property key decorated by the decorator


readonly propertyName: string;

Alias of the property


readonly index: number;

Parameter index


readonly descriptor: number;

Method's descriptor


readonly decoratorType: DecoratorTypes;

Decorator type used to the JsonSchemaStore.


collectionType: Type<any>;

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


token: Type<any>;

protected _type: Type<any>;

protected _target: Type<any>;

get target(): Type<any>;

Reference to the class


get targetName(): string;

Return the class name of the entity.


get collectionName(): string;

Return the collection name


get type(): Type<any> | any;

set type(value: Type<any> | any);

Get original type without transformation


get typeName(): string;

Return target type name


get computedType(): Type<any>;

Return the itemSchema target type. if the type is a function used for recursive model, the function will be called to get the right type.


get isCollection(): boolean;

get isArray(): boolean;

get isPrimitive(): boolean;

get isDate(): boolean;

get isObject(): boolean;

get isClass(): boolean;

Other topics