import type { Component, ComponentConstructor } from "./Component"; export declare type EntityID = string | number; export declare class Entity { static readonly isEntity = true; id: EntityID; private map; constructor(id?: EntityID | { id: EntityID; }); /** * If `klass` is not passed, returns all components on `this`. Otherwise, * returns the components of type `C` on `this`. */ get(klass?: K): ReadonlyArray | undefined>; /** * Adds `component` to `this`. */ add>(klass: K, component: C): void; has(klass: K): boolean; /** * If no argument is passed, all components are cleared. If a constructor is * passed, all components of that type are cleared. If a specific component * is passed, that component is cleared. */ clear(arg?: T): boolean; get components(): Component[]; toJSON(): { id: EntityID; components: ReturnType[]; [key: string]: unknown; }; static fromJSON({ components, ...rest }: ReturnType): Entity; }