Toolbox-XToolbox-X

Inspect Class & Its Methods

Introspect and summarize the instance/static methods and getters of JavaScript/TypeScript classes.

Overview

Powerful utilities for examining and summarizing the instance/static methods and getters of JavaScript/TypeScript classes. Analyze class APIs, count methods/getters, and get comprehensive breakdowns—great for meta-programming, documentation tooling, and runtime validation.


Example Usage

playground.ts

Function Signatures

getInstanceMethodNames

function getInstanceMethodNames(cls: Constructor): string[]

Returns alphabetical names of instance methods defined directly on the class prototype (excluding constructor and getters).

getStaticMethodNames

function getStaticMethodNames(cls: Constructor): string[]

Returns alphabetical names of static methods defined directly on the class itself.

getInstanceGetterNames

function getInstanceGetterNames(cls: Constructor): string[]

Returns alphabetical names of instance getters defined directly on the class prototype.

getStaticGetterNames

function getStaticGetterNames(cls: Constructor): string[]

Returns alphabetical names of static getters defined directly on the class itself.

getClassDetails

function getClassDetails(cls: Constructor): ClassDetails

Returns a structured summary object containing method names, getter names, and their respective counts.


Types

ClassDetails

interface ClassDetails {
  instanceMethods: string[];
  staticMethods: string[];
  instanceGetters: string[];
  staticGetters: string[];
  instanceCount: number;
  staticCount: number;
  totalGetters: number;
  totalMethods: number;
}

Last updated: Sun, Jun 14, 2026 07:06:16AM (UTC)

On this page