How to fix Type 'X' is not a constructor or has a signature in TypeScript

TypeScriptINTERMEDIATEMEDIUMUpdated Dec 11, 2025ยท 147 views

This TypeScript error occurs when attempting to instantiate a type with the new operator that lacks a constructor signature. It commonly happens when trying to use interfaces, type aliases, or incorrectly imported types as constructors.

Quick fix

Fixes Type 'X' is not a constructor or has a signature

import type { MyClass } from './my-class';
const instance = new MyClass(); // Error: not a constructor
  1. Verify you are importing a value, not just a type
  2. Check for interface or type alias usage
  3. Fix module import mismatches
  4. Add constructor signature constraint to generic types
typescript โ€” error
import type { MyClass } from './my-class';
const instance = new MyClass(); // Error: not a constructor
Type 'X' is not a constructor or has a signature

What this error means

This error appears when TypeScript detects an attempt to use the `new` operator on a type that doesn't have a construct signature. In TypeScript, not all types can be instantiated - only classes and types with explicit constructor signatures can be used with `new`. The error most commonly occurs in scenarios like trying to instantiate an interface or type alias, using a type-only import as a constructor, or when there's a mismatch between how a module exports a class and how it's imported. TypeScript's type system distinguishes between the static side of a class (the constructor) and the instance side, and this error indicates that the type being used doesn't represent the constructor side. This can also occur with `esModuleInterop` settings when there's a mismatch between CommonJS and ES module exports, causing TypeScript to interpret a default export differently than expected.

Typical symptoms

  • Compilation fails when trying to instantiate a type with new
  • IDE shows red squiggly lines under new SomeType() expressions
  • Error appears despite the class or constructor appearing to be correctly defined
  • Code that worked in JavaScript fails when converted to TypeScript
  • Runtime error "X is not a constructor" after successful compilation

Common causes

  1. Attempting to instantiate an interface or type alias with the new operator
  2. Using a type-only import instead of a value import
  3. Importing a class incorrectly due to module system mismatches (CommonJS vs ES modules)
  4. Trying to use a type parameter that is not constrained to have a constructor signature
  5. Importing from a module with default exports when using esModuleInterop
  6. Exporting a type and value with the same name, causing import confusion
  7. Using an abstract class without proper type constraints

How to fix "Type 'X' is not a constructor or has a signature"

1Verify you are importing a value, not just a type

Check your import statement to ensure you're importing the actual class or constructor, not a type definition.

Incorrect (type-only import):

typescript
import type { MyClass } from './my-class';
const instance = new MyClass(); // Error: not a constructor

Correct (value import):

typescript
import { MyClass } from './my-class';
const instance = new MyClass(); // Works

If you're using import type, remove the type keyword or use a separate import for the value.

2Check for interface or type alias usage

Interfaces and type aliases define shapes but cannot be instantiated. Replace them with classes if you need constructors.

Problem:

typescript
interface User {
  name: string;
  age: number;
}

const user = new User(); // Error: not a constructor

Solution (use a class):

typescript
class User {
  constructor(public name: string, public age: number) {}
}

const user = new User('Alice', 30); // Works

Alternatively, create an object literal or factory function instead of using new.

3Fix module import mismatches

When using esModuleInterop, default exports may need different import syntax.

If you get this error with a library:

typescript
import * as EventEmitter from 'events';
const emitter = new EventEmitter(); // May fail

Try default import instead:

typescript
import EventEmitter from 'events';
const emitter = new EventEmitter(); // Works

Or check your tsconfig.json and ensure esModuleInterop is enabled:

json
{
  "compilerOptions": {
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true
  }
}
4Add constructor signature constraint to generic types

If using a generic type parameter that should be constructable, add a constructor constraint.

Problem:

typescript
function create<T>(Type: T): T {
  return new Type(); // Error: not a constructor
}

Solution (add constructor constraint):

typescript
function create<T>(Type: new () => T): T {
  return new Type(); // Works
}

// Or with parameters:
function createWith<T>(Type: new (name: string) => T, name: string): T {
  return new Type(name);
}

The new () => T syntax indicates that Type must be a constructor function.

5Separate type and value exports

If you're exporting both a type and a value with the same name, ensure imports are correct.

Export file (my-module.ts):

typescript
// Export the class (value)
export class Logger {
  log(msg: string) { console.log(msg); }
}

// Export the type (if needed separately)
export type { Logger as LoggerType };

Import file:

typescript
// Import the class value
import { Logger } from './my-module';
const logger = new Logger(); // Works

// Or import both
import { Logger, type LoggerType } from './my-module';
6Check compilation target settings

If the error occurs only at runtime, check your TypeScript compilation target.

In tsconfig.json, ensure your target is appropriate:

json
{
  "compilerOptions": {
    "target": "ES2015",  // or higher
    "module": "commonjs"
  }
}

Some class features require ES2015 or higher. If targeting ES5, ensure your transpilation is handling classes correctly. You may also need to check if polyfills are required for your environment.

Advanced notes

Constructor Signatures in Detail:

TypeScript distinguishes between the instance type of a class and its constructor type. The constructor type is represented using construct signatures: { new (...args): InstanceType }. This is particularly important when working with factory patterns or dependency injection.

esModuleInterop and Module Systems:

The esModuleInterop flag affects how TypeScript handles default exports from CommonJS modules. When enabled, it allows default imports from modules that don't explicitly have a default export, but this can sometimes cause type system confusion about what is and isn't a constructor. This is a common source of this error when migrating JavaScript codebases to TypeScript.

Abstract Classes:

Abstract classes cannot be instantiated directly but can be used in type positions that require constructor signatures if properly constrained:

typescript
abstract class Base {
  abstract getValue(): number;
}

// This will error unless properly constrained
function factory<T extends Base>(Ctor: new () => T): T {
  return new Ctor(); // T must be a concrete class, not abstract
}

Type-Only Imports (TypeScript 3.8+):

The import type syntax was introduced to explicitly import only types, which are erased at runtime. This helps with tree-shaking but can cause this error if you accidentally use it for values you need to instantiate.

Frequently asked questions

What does "Type 'X' is not a constructor or has a signature" mean?
This error appears when TypeScript detects an attempt to use the new operator on a type that doesn't have a construct signature. In TypeScript, not all types can be instantiated - only classes and types with explicit constructor signatures can be used with new. The error most commonly occurs in scenarios like trying to instantiate an interface or type alias, using a type-only import as a constructor, or when there's a mismatch between how a module exports a class and how it's imported.
How do I fix "Type 'X' is not a constructor or has a signature"?
This TypeScript error occurs when attempting to instantiate a type with the new operator that lacks a constructor signature. It commonly happens when trying to use interfaces, type aliases, or incorrectly imported types as constructors.
What causes "Type 'X' is not a constructor or has a signature"?
Attempting to instantiate an interface or type alias with the new operator Using a type-only import instead of a value import Importing a class incorrectly due to module system mismatches (CommonJS vs ES modules)
Is the "Type 'X' is not a constructor or has a signature" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading