How to fix The type 'this' is not a constructor function type in TypeScript

TypeScriptINTERMEDIATEMEDIUMUpdated Dec 11, 2025· 116 views

TypeScript shows this error when you try to call `new this()` while `this` still refers to the current instance. Move the factory into a static method or cast the constructor side so that `this` has a construct signature.

Quick fix

Fixes TS2507

class Base {
  static create<T extends typeof Base>(this: T) {
    return new this();
  }
}

class Derived extends Base {}

const derived = Derived.create(); // OK, `Derived` is returned
  1. Put `new this()` into a static factory so `this` stays constructable
  2. Read the constructor from the instance before calling `new`
  3. Use an explicit constructor parameter or helper typed with `new () => ...`
typescript — error
class Base {
static create<T extends typeof Base>(this: T) {
return new this();
}
}
class Derived extends Base {}
const derived = Derived.create(); // OK, `Derived` is returned
The type 'this' is not a constructor function type

What this error means

The compiler complains "The type 'this' is not a constructor function type" because it resolved the expression inside `new` to the instance type (the `this` type) instead of the constructor type. Instance members only see the instance side of the class; they don't expose constructor signatures and therefore cannot be invoked with `new`. Static methods receive the polymorphic `this` that represents the constructor itself, which is why `new this()` is allowed inside a static factory. When you try to instantiate `this` from an instance method or a helper that expects an instance type, TypeScript raises TS2507 to prevent a runtime `TypeError`, because the instance value has no construct signature. You can keep the behavior you want by either moving the factory into a static method whose `this` is the constructor or by explicitly capturing the constructor (for example via `this.constructor as typeof Base` or by passing the constructor to a helper that expects an object with `new ()`).

Typical symptoms

  • tsc exits with TS2507: The type 'this' is not a constructor function type
  • The error highlights a `new this()` call inside an instance method or helper
  • IDE shows a squiggly line on `new this()` even though runtime JavaScript would work
  • Polymorphic factory code that clones `this` fails to compile
  • Mixin or decorator helpers that try to instantiate the current object hit the error
  • The compilation stop makes it clear that TypeScript refuses to treat the instance as constructable

Common causes

  1. `new this()` is invoked from an instance method, but `this` only refers to the instance type
  2. `this` is typed without a `new () =>` constraint, so the compiler believes it lacks a constructor
  3. A helper receives an object typed as `this` and immediately tries to use `new` on it
  4. Arrow functions capture `this` from the instance and attempt to instantiate it later
  5. The `this` parameter is declared as an interface or instance type rather than a constructor
  6. Generics rely on the instance-type `this` instead of the polymorphic constructor type

How to fix "The type 'this' is not a constructor function type"

1Put `new this()` into a static factory so `this` stays constructable

Static methods receive the constructor as their polymorphic this type. Moving the factory to a static method lets TypeScript know that this is compatible with new:

ts
class Base {
  static create<T extends typeof Base>(this: T) {
    return new this();
  }
}

class Derived extends Base {}

const derived = Derived.create(); // OK, `Derived` is returned

Now this refers to the derived constructor (the static side) so new this() is allowed and your subclasses continue to work.

2Read the constructor from the instance before calling `new`

When you really need to instantiate from an instance method, grab this.constructor and cast it to the class constructor that actually has a new signature:

ts
class Base {
  clone() {
    const Ctor = this.constructor as typeof Base;
    return new Ctor();
  }
}

const clone = new Base().clone(); // OK after the cast

This pattern satisfies the compiler because you're calling new on a constructor type rather than the instance type that this normally represents.

3Use an explicit constructor parameter or helper typed with `new () => ...`

If you pass the constructor to a helper, make sure the helper expects a constructable type:

ts
function spawn<Ctor extends new () => InstanceType<Ctor>>(Ctor: Ctor) {
  return new Ctor();
}

class Widget {
  spawnSibling() {
    return spawn(this.constructor as new () => Widget);
  }
}

The helper is typed around a constructor, so TypeScript does not try to treat the instance-type this as a constructor and the error goes away.

Advanced notes

Remember that the 'this' type inside instance members represents the current value, not its constructor, so TypeScript keeps the instance and static sides separate. The polymorphic 'this' type in static members or 'typeof' references is the safe way to keep derived constructors working with 'new this()'. For factories that need the constructor inside instance code, pass it explicitly or cast 'this.constructor' to the right constructor signature; otherwise TS2507 will keep you honest.

Frequently asked questions

What does "TS2507" mean?
The compiler complains "The type 'this' is not a constructor function type" because it resolved the expression inside new to the instance type (the this type) instead of the constructor type. Instance members only see the instance side of the class; they don't expose constructor signatures and therefore cannot be invoked with new. Static methods receive the polymorphic this that represents the constructor itself, which is why new this() is allowed inside a static factory.
How do I fix "TS2507"?
TypeScript shows this error when you try to call new this() while this still refers to the current instance. Move the factory into a static method or cast the constructor side so that this has a construct signature.
What causes "TS2507"?
new this() is invoked from an instance method, but this only refers to the instance type this is typed without a new () => constraint, so the compiler believes it lacks a constructor A helper receives an object typed as this and immediately tries to use new on it
Is the "TS2507" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading