Skip to content

Constructor type ​

A type for any class producing a T: mixins, dependency injection tokens, instanceof helpers.

ts
import type { Constructor } from 'utils';

Signature ​

ts
export type Constructor<T = object, TArguments extends unknown[] = any[]> = new (...parameters: TArguments) => T;

Parameters ​

NameDescription
TType of the instances.
TArgumentsParameters of the constructor.

Tests ​

Line coverage: 0 %.

Source ​

src/types/constructor.ts (on GitHub)

Source code
ts
/**
 * A type for any class producing a `T`: mixins, dependency injection tokens, `instanceof` helpers.
 *
 * @template T - Type of the instances.
 * @template TArguments - Parameters of the constructor.
 */
export type Constructor<T = object, TArguments extends unknown[] = any[]> = new (...parameters: TArguments) => T;

Keywords: constructor, types, type

Generated from the JSDoc of the sources.