Skip to content

@kubb/parser-ts

This library contains the building blocks that can be used to create TypeScript code. All of this is based on the TypeScript AST engine. A good tool to visualize what AST is can be found on TypeScript AST Viewer, here you can visualize the AST based on some TypeScript code.

To get started with TypeScript AST, I would suggest following this tutorial: Generating TypeScript using AST's.


This library contains also the logic to print the nodes(convert AST nodes to string).

Installation

shell
bun add @kubb/parser-ts
shell
pnpm add @kubb/parser-ts
shell
npm install @kubb/parser-ts
shell
yarn add @kubb/parser-ts

API

  • print: Convert AST TypeScript nodes to a string based on the TypeScript printer.
  • format: Format the generated code based on the TypeScript printer.

Released under the MIT License.