Officialv5.5.1MITkubb >=5.0.0node >=22

@kubb/parser-ts

Prints the Kubb AST to TypeScript source with the official TypeScript compiler, so every plugin writes real `.ts`, `.tsx`, `.js`, and `.jsx` files.

typescripttsxparserprinterast
Stijn Van Hulle

Stijn Van Hulle

@stijnvanhulle

Downloads
327.9K/ mo
Stars
1.8K
Bundle size
147.6 kB
Updated
12h ago

@kubb/parser-ts prints Kubb's AST as TypeScript using the official TypeScript compiler. It resolves imports, emits exports and JSDoc, and applies the extension mapping.

  • parserTs() handles .ts and .js.
  • parserTsx() handles .tsx and .jsx.

Both run by default alongside parserMd. A custom parsers array replaces that default set. Include every parser your plugins need. Unmatched files are written as source text.

Installation

bun add -d @kubb/parser-ts

Dependencies

No plugin dependencies. The parser registers on defineConfig.parsers.

Example

Override import extensions while keeping every default parser registered.

kubb.config.ts
import { defineConfig } from 'kubb'
import { parserTs, parserTsx } from '@kubb/parser-ts'
import { parserMd } from '@kubb/parser-md'
import { pluginTs } from '@kubb/plugin-ts'

export default defineConfig({
  input: './petStore.yaml',
  output: { path: './src/gen' },
  parsers: [
    parserTs({ extension: { '.ts': '.js' } }),
    parserTsx(),
    parserMd(),
  ],
  plugins: [pluginTs()],
})

See also