Skip to content

unacy / ClassType

Type Alias: ClassType

ts
type ClassType = (...args) => any;

Defined in: packages/core/src/types.ts:185

A class constructor (including abstract classes) that can serve as a unit's type identity. At runtime, the constructor itself is stored in the metadata type field.

Parameters

ParameterType
...argsany[]

Returns

any

Remarks

When the registry detects a class-typed unit (via isClassMetadata), the unit accessor's brand function calls new Constructor(...args) so that registry.MyUnit(arg1, arg2) returns a properly constructed instance.

Pitfalls

NEVER pass an arrow function or a bound function as a ClassType — they lack a prototype property and will fail validateClass at registration.

Released under the MIT License.