styledsea

Auto Type Table

Auto-generated type table

PropTypeDefault
name
string
-
options
Partial<{ a: unknown; }>
-

Usage

npm install styledsea-docs-typescript

It accepts a path prop which should be a typescript file, and name for the exported type name.

import { AutoTypeTable } from 'styledsea-docs-typescript/ui';
 
<AutoTypeTable path="./path/to/file.ts" name="MyInterface" />

Server Component only

You cannot use this in a client component.

Functions

Notice that only object type is allowed. For functions, you should wrap them into an object instead.

export interface MyInterface {
  myFn: (input: string) => void;
}

Auto Type Table

PropTypeDefault
path
string
-
name
string
-
options
GenerateOptions
-

File System

It relies on the file system, hence, the page referencing this component must be built in build time. Rendering the component in serverless runtime may cause problems.

Deep Dive

Under the hood, it uses the Typescript Compiler API to extract type information. Your tsconfig.json file in the current working directory will be loaded.

To change the compiler settings, pass a options prop to the component.

Learn more about Typescript Docs Generation.

Last updated on

On this page

Edit on GitHub