Skip to content

Update custom Constructor type to better align with generic constructor from TS Handbook #76

@brandongregoryscott

Description

@brandongregoryscott

While the current version of the Constructor type seems to work, we recently encountered a scenario where we needed to leverage TS Mixins to extend a base class. The generic constructor signature they provide in the example docs has the values rest parameter typed as any[], not any, and would not accept otherwise. Thinking about it more, it probably should be any[].

Suggested signature (reference):

export type Constructor<T = {}> = new (...values: any[]) => T;

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions