export abstract class Component { static readonly _id: number = 0; static readonly id: number; public abstract reset(object: this, ...args: any[]): void; } export function makeComponent(constructor: any) { constructor.id = (Component)._id++; } type NonFunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T]; type NonFunctionProperties = Pick>; export type EntityOf = NonFunctionProperties; export type ComponentConstructor = { new(): Component; id: number } export interface ComponentInitializator { component: T; args?: T['prototype']['reset']; }