TypeScript Utility Types
InstanceType<T> — extract a constructed instance
InstanceType derives the instance type described by a construct signature. The constructor itself, including its static properties, is a different type from the constructed object. Abstract constructor signatures are valid inputs, but the resulting type does not authorize calling new on an abstract class. It does not construct an instance at runtime. Example output: "3". Verified with strict TypeScript 5.8.3, ES2022 and Node.js 22.16.0. This utility affects static typing; no runtime validation or transformation is supplied by the type itself.
Formal Syntax & Structure
typescript syntaxtypescript
InstanceType<T>Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| T | T extends abstract new (...args: any) => any | Construct signature or typeof a class. |
Working Example
Example Snippettypescript
class Counter { constructor(public count: number) {} increment() { this.count++; } }const counter: InstanceType<typeof Counter> = new Counter(2);counter.increment();console.log(counter.count);