What it is and why to use it
A construct signature describes a value that can be called with new. It is different from the instance type produced by that constructor. This is useful for passing a class into a small factory while checking the arguments and the shape of the created object.
Common mistakes and limitations
An interface describing instance methods does not automatically describe its constructor. Abstract constructors cannot be directly instantiated by a function like this; accepting them requires a different contract and an implementation that does not call new on an abstract type.
Run this example
Use TypeScript 5.8 or later with strict checking and an ES2022 target. Save each complete example independently as example.ts, compile it, then run the generated JavaScript with a compatible Node.js installation. Compiler-only options below affect checking; they do not add runtime validation.
Terminal — compile and run
npx tsc example.ts --strict --target ES2022 --module commonjs
node example.jsSyntax
type Factory = new (name: string) => Person;Examples
Typing Constructor Values
Standalone TypeScript 5.8+ example; expected output is explained below.
class Person {
constructor(public name: string) {}
}
function create(Type: new (name: string) => Person): Person {
return new Type("John");
}
console.log(create(Person).name);- Person used as a value is the constructor function.
- The new signature accepts a constructor taking a string and producing a Person instance.
- create calls that constructor and returns the instance. The name comes from the actual constructor body generated for the parameter property.
- Expected output: John
Best practices
- An interface describing instance methods does not automatically describe its constructor. Abstract constructors cannot be directly instantiated by a function like this; accepting them requires a different contract and an implementation that does not call new on an abstract type.
- Keep external-input validation separate from compile-time type descriptions.
Runtime & versions
Compiled to JavaScript. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
TypeScript Handbook