- Downloads
- 367.4K/ mo
- Stars
- 1.8K
- Bundle size
- 148.2 kB
- Updated
- 1d 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.
| Parser | File extensions |
|---|---|
parserTs() | .ts, .js |
parserTsx() | .tsx, .jsx |
Both run by default alongside parserMd.
A custom
parsers array replaces the default set. Include every parser your plugins need. Unmatched files are written as source text.Installation
bun add -d @kubb/parser-tspnpm add -D @kubb/parser-tsnpm install --save-dev @kubb/parser-tsyarn add -D @kubb/parser-tsDependencies
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()],
})