This error occurs when you try to use the `new` operator with a type that lacks a constructor signature. TypeScript requires types used with `new` to have explicit construct signatures.
This TypeScript error happens when you attempt to instantiate a type using the `new` operator, but the type definition doesn't include a constructor signature. TypeScript distinguishes between regular types and constructor types - only types with construct signatures (indicated by the `new` keyword) can be instantiated. The error typically appears when working with generic types, type aliases, or interfaces that represent values rather than classes. TypeScript's type system requires explicit constructor signatures to ensure type safety when creating new instances. At compile time, TypeScript validates that any type used with `new` has a proper construct signature matching the arguments provided. This prevents runtime errors where non-constructor values are mistakenly called as constructors.
If you're defining a type that should be constructable, add a construct signature using the new keyword:
// Before (incorrect)
type Constructor = () => Object;
// After (correct)
type Constructor = new () => Object;For types that accept constructor parameters:
type Constructor<T> = new (...args: any[]) => T;When using generics with the new operator, constrain the type parameter to ensure it has a constructor:
// Before (causes error)
function create<T>(type: T): T {
return new type(); // Error: Type is not a constructor type
}
// After (correct)
function create<T>(type: new () => T): T {
return new type();
}
// Usage
class MyClass {}
const instance = create(MyClass);For constructors with parameters:
function create<T>(type: new (...args: any[]) => T, ...args: any[]): T {
return new type(...args);
}Define an interface specifically for constructor types:
interface Constructable<T> {
new (...args: any[]): T;
}
function instantiate<T>(ctor: Constructable<T>, ...args: any[]): T {
return new ctor(...args);
}
class Person {
constructor(public name: string) {}
}
const person = instantiate(Person, "Alice");TypeScript allows importing types separately from values. Make sure you're importing the actual class:
// Before (type-only import)
import type { MyClass } from './my-class';
const instance = new MyClass(); // Error: cannot use type-only import
// After (value import)
import { MyClass } from './my-class';
const instance = new MyClass(); // WorksCheck your import statements and remove the type keyword if you need the runtime value.
When referencing the constructor type of an existing class, use typeof:
class Animal {
constructor(public name: string) {}
}
// Correct way to type the constructor
function createAnimal(ctor: typeof Animal, name: string): Animal {
return new ctor(name);
}
// Or with generics
function create<T>(ctor: new (...args: any[]) => T): T {
return new ctor();
}Ensure your type definitions properly separate static and instance types:
// Define instance type
interface ClockInterface {
currentTime: Date;
setTime(d: Date): void;
}
// Define constructor type
interface ClockConstructor {
new (hour: number, minute: number): ClockInterface;
}
// Use both together
function createClock(
ctor: ClockConstructor,
hour: number,
minute: number
): ClockInterface {
return new ctor(hour, minute);
}
class DigitalClock implements ClockInterface {
constructor(h: number, m: number) {}
currentTime: Date = new Date();
setTime(d: Date) {
this.currentTime = d;
}
}
const clock = createClock(DigitalClock, 12, 17);Constructor Signatures vs Call Signatures: TypeScript distinguishes between call signatures () and construct signatures new (). A type can have both, allowing it to be called as a function or instantiated as a constructor. JavaScript built-ins like Date have both signatures.
Abstract Classes: Abstract classes cannot be instantiated directly, even though they have constructors. If you're getting this error with an abstract class, ensure you're instantiating a concrete subclass instead.
Mixin Patterns: When working with class mixins, constructor signatures become more complex. TypeScript 2.2+ improved support for mixin patterns with constructor types like new (...args: any[]) => {}.
Generic Constraints: You can combine constructor types with other constraints: <T extends BaseClass>(ctor: new () => T) ensures the type is both constructable and extends a base class.
Type vs Value Space: This error often reveals confusion between TypeScript's type space (compile-time) and value space (runtime). The new operator works in value space, so the type must represent a runtime constructor function, not just a compile-time type definition.
Function expression requires a return type
Function expression requires a return type
Value of type 'string | undefined' is not iterable
How to fix "Value is not iterable" in TypeScript
Type 'undefined' is not assignable to type 'string'
How to fix "Type undefined is not assignable to type string" in TypeScript
Type narrowing from typeof check produces 'never'
How to fix "Type narrowing produces never" in TypeScript
Type parameter 'T' has conflicting constraints
How to fix "Type parameter has conflicting constraints" in TypeScript