Type Alias: CallableNewable<ClassConstructorOptions, C>
ts
type CallableNewable<ClassConstructorOptions, C> = {
(...args: ConstructorParameters<C>): InstanceType<C>;
schema: ObjectSchema<ClassConstructorOptions>;
} & (...args: ConstructorParameters<C>) => InstanceType<C> & {
prototype: InstanceType<C>;
};A hybrid type that represents a constructor function which can be called both with and without the new keyword. This type enables creating data type classes that work as both constructors and factory functions.
Type Declaration
| Name | Type |
|---|---|
prototype | InstanceType<C> |
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
ClassConstructorOptions extends BaseInterface | - | The interface defining the constructor options for the class |
C extends BaseClass | BaseClass | The abstract constructor type constraint |