Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

TypeScript · Type Alias

InstanceType

InstanceType<Type> derives the instance type produced by a constructor function. For a class, pass typeof ClassName to obtain the type of objects created with new ClassName().

Since
2.8

How it works

InstanceType<Type> derives the instance-side type produced by a constructor function. Pass a class value with typeof to describe the constructor, then use the resulting type wherever instances of that class are expected.

Syntax

InstanceType<Type>

Parameters

NameTypeDescription
Typeabstract new (...args: any) => anyA type representing an abstract or concrete constructor function, constrained by abstract new (...args: any) => any.

Returns

A type consisting of the instance type created by the constructor in Type.

Key points

  • It produces the instance-side type associated with a constructor function.
  • No import is needed because InstanceType is a globally available utility type.
  • The utility type was introduced in TypeScript 2.8.

Common mistakes

  • The type argument must satisfy the constructor constraint; ordinary types such as string are rejected.
  • The broad Function type is not specific enough to satisfy the required constructor signature.

Example: Derive an instance type from a class constructor

class Point {
  constructor(public x: number, public y: number) {}
}

type PointInstance = InstanceType<typeof Point>;

function moveRight(point: PointInstance) {
  point.x += 5;
}

const point = new Point(3, 4);
moveRight(point);
console.log(point.x); // 8

typeof Point captures the constructor value, and InstanceType derives the type of objects created by that constructor.

When to use it

Model constructor-produced values

A generic API accepts a class constructor and needs to type values created from it.

Reuse a class's instance type

A codebase needs an instance type without duplicating a class name in a type declaration.

Keep constructor and instance APIs aligned

A library exposes constructors and wants types to follow their concrete instance shapes.

Interview questions

QWhat does InstanceType do, and how is it used with a class?

InstanceType<Type> constructs the type of instances created by the constructor represented by Type. For a class named C, InstanceType<typeof C> evaluates to C.

Follow-up: What happens for InstanceType<any> and InstanceType<never>? They evaluate to any and never, respectively.

QWhat constraint must the type argument satisfy?

The type parameter is constrained to an abstract construct signature: abstract new (...args: any) => any. This ensures the supplied type represents something callable with new.

Follow-up: Why use typeof C rather than C? C is the instance type, while typeof C is the constructor value type needed by InstanceType.

QWhen was InstanceType introduced, and where is it available?

The utility was released in TypeScript 2.8 and is globally available as a built-in utility type. It is intended for common type transformations involving constructor functions.

Follow-up: How would you model a function that accepts a constructor and returns its instance? Use a generic constructor parameter constrained by an abstract construct signature, then apply InstanceType to that parameter.

  • Constructor Signatures
  • typeof operator
  • Classes
  • ReturnType
  • Instance-side type

Source: Documentation - Utility Types - TypeScript. Checked 2026-10-15.