Documentation

ComponentConstructor

type ComponentConstructor

type ComponentConstructor<TComponent extends Component = Component> = new (...args: any[]) => TComponent;

Generic constructor type for Component, matching both parameterless constructors and those with one or more required parameters.

For a constructable type, combine with a specific function type, e.g. ComponentConstructor & (new () => MyComponent).

This type is mostly used to define parameters of overridden implementations of Component.preset.

Example

The following example is part of the code for the actual Application class:

export class Application extends Component {
  static preset(presets: Application.Presets,
    ...activities: Array<ComponentConstructor &
        (new () => AppActivity)>): Function {
    // ...
  }
  // ...
}