collectype

collectype v0.11.0


collectype / types/utility / Constructor

Type Alias: Constructor()<T>

Constructor<T> = (items) => T

Defined in: types/utility.ts:15

Generic constructor type for a class that takes an array of items as its only argument. Used to type the constructor parameter for function classes in CollecType collections.

Type Parameters

T

T

The instance type returned by the constructor.

Parameters

items

any[]

Returns

T

Example

// Suppose you have a class:
class MyFunctions {
  constructor(items: string[]) {}
}
// You can use Constructor<MyFunctions> to type a constructor:
const fnClass: Constructor<MyFunctions> = MyFunctions;