Documenting TypeScript

In this article

API documentation for TypeScript can be enabled using the API Extractor:

Currently supports:

  • Interfaces

Only items that are publicly exported (i.e. exported from the main entrypoint and marked with @public) will be included.

Usage

::: api [OPTIONS]
TYPE:NAME
:::

where:

  • OPTIONS is an optional list of rendering options.
  • TYPE is the kind of item to display, e.g. interface.
  • NAME is the name of the item to display.

For instance:

::: api
interface:ExampleInterface
:::

Interfaces

Interfaces can either be shown as code (default) or as a property table.

Options

code (default)

Renders interface as code.

properties

Renders interface as a property table.

inherit

Includes members inherited from parent interfaces.

For property tables, this is the default behavior.

noinherit

Excludes inherited members.

For code, this is the default behavior.

Examples

Input:

::: api
interface:ExampleInterface
:::

Output:

interface ExampleInterface {
    /**
     * Persons age
     */
    age: number;
    /**
     * Persons name
     */
    name: string;
    /**
     * Optional nickname
     */
    nickname?: string;
}

Input:

::: api properties
interface:ExampleInterface
:::

Output:

age: number;
Persons age
name: string;
Persons name
nickname?: string; Optional
Optional nickname

Search

Esc to close Arrow up/down to navigate Enter to select

Select version

Please wait, loading version data...