Registry / devops / dtsgenerator

dtsgenerator

JSON →
library3.19.2jsnpmunverified

TypeScript d.ts file generator from JSON Schema or OpenAPI spec files. Current stable version: 3.19.2. Released as needed; follows semver. Key differentiator: supports both JSON Schema and OpenAPI (Swagger) specs, generates TypeScript type definitions directly, includes plugin support for customization, and uses TypeScript AST internally for robust output. Requires Node >= 18.0.

npm install dtsgenerator
INSTALL
IMPORT
SIG · DTSGENERATOR
D
dtsgenerator
devopsjavascriptv3.19.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dtsgenerator
import dtsgenerator from 'dtsgenerator'
const dtsgenerator = require('dtsgenerator')
Package is ESM-only; default export is the main function.
parseSchema
import { parseSchema } from 'dtsgenerator'
const { parseSchema } = require('dtsgenerator')
Named export for parsing a JSON Schema object.
dtsgenerator as namespace import
import * as dtsgen from 'dtsgenerator'
import dtsgen from 'dtsgenerator'
Namespace import can be used, but the default import is sufficient for the main function.

Generates TypeScript type definitions from a JSON Schema using the Node.js API.

import dtsgenerator from 'dtsgenerator'; import { parseSchema } from 'dtsgenerator'; const schema = { type: 'object', properties: { name: { type: 'string' }, age: { type: 'integer' } }, required: ['name'] }; dtsgenerator({ contents: [parseSchema(schema)], config: {} }).then(content => { console.log(content); }).catch(err => { console.error(err); });
Debug
Known issues
breakingRemove the `--namespace` option. Use the `@dtsgenerator/replace-namespace` plug-in instead.
fix
Use the @dtsgenerator/replace-namespace plugin to handle namespaces.
affects: >=3.0.0
breakingChange the command line options; removed `--namespace`, added `--config`, etc.
fix
Update CLI usage; see migration guide.
affects: >=3.0.0
breakingTypeScript AST is now used internally to generate type definitions.
fix
Ensure compatibility with the new internal AST; plugins must adhere to new API.
affects: >=3.0.0
gotchaPackage requires Node >= 18.0.
fix
Upgrade Node.js to version 18 or higher.
affects: >=3.0.0
gotchadtsgenerator is ESM-only; cannot use require() without additional setup.
fix
Use import syntax or configure your project for ESM.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'dtsgenerator'
Missing or incorrect installation
fix
Run `npm install dtsgenerator` or `npm install -g dtsgenerator`.
TypeError: dtsgenerator is not a function
Wrong import style (CJS require on ESM-only package)
fix
Use `import dtsgenerator from 'dtsgenerator'`.
SyntaxError: Unexpected token 'export'
Using CJS require() on ESM module without transpilation
fix
Switch to ESM imports or use dynamic import: `const dtsgenerator = await import('dtsgenerator')`.
Upgrade
Version history
3.19.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
dtsgenerator — npm install dtsgenerator · libregistry