# TypedConstructor

`type` in `types` · v0.9.1-next.0

<https://docs.seedcord.org/packages/types/0.9.1-next.0/types/typed-constructor>

Extracts the constructor signature from a constructor type. `typeof` on an abstract class gives an `abstract new (...)` signature that TypeScript refuses to assign to a plain `new (...)`, and this drops the modifier so both kinds of class reference resolve to the same newable shape.

## Examples

```ts
class Example {
  constructor(public name: string, public age: number) {}
}

type Result = TypedConstructor<typeof Example>; // Result: new (name: string, age: number) => Example
```

## Declaration

```ts
type TypedConstructor<ConstructorType> = ConstructorType extends new (
    ...args: infer A
) => infer R
    ? new (...args: A) => R
    : ConstructorType extends abstract new (...args: infer A) => infer R
      ? new (...args: A) => R
      : never;
```
