-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Add --just-types support for --lang javascript to generate JSDoc-only output
Context (Input, Language)
Input Format:
JSON Schema
Output Language:
JavaScript (with JSDoc)
Description
quicktype already supports --just-types for TypeScript, which generates clean, type-only output without any runtime conversion or validation code. This is extremely useful when the goal is to use types purely for tooling (IntelliSense, static checking, documentation) and not for runtime parsing.
For JavaScript users who rely on JSDoc for typing (often combined with // @ts-check), there is currently no equivalent. Generating JavaScript output always produces a large amount of runtime conversion / validation code, even when only type information is desired.
Adding --just-types support to --lang javascript would enable quicktype to generate pure JSDoc typedefs without any executable code.
Current Behaviour / Output
When running:
quicktype --lang javascript --src schema.json
quicktype generates:
- runtime conversion functions
- validation helpers
- parsing / serialization logic
- no JSDoc comments
This output is overly complex and unsuitable for users who only want:
- JSDoc
@typedefdeclarations - zero runtime footprint
- simple, readable type definitions
Proposed Behaviour / Output
When running:
quicktype --lang javascript --just-types --src schema.json
quicktype should generate:
- only JSDoc type definitions
- no functions
- no runtime validation
- no parsing / serialization helpers
Example output:
/**
* @typedef {Object} User
* @property {string} name
* @property {string} email
*/
This would mirror the existing --just-types behavior for TypeScript, but adapted to idiomatic JSDoc.
Solution
Extend the existing --just-types implementation so that:
- it is accepted for
--lang javascript - it suppresses all runtime code generation
- it emits only JSDoc
@typedefblocks for all generated types
Internally, this could reuse the same model as TypeScript --just-types, but render JSDoc instead of TS interfaces.
Alternatives
- Generating TypeScript
.d.tsfiles and importing them via JSDocimport()works, but:- introduces an extra language step
- is less direct than native JSDoc output
- Post-processing quicktype’s JavaScript output to strip runtime code is brittle and error-prone
- Other tools (e.g. JSON Schema → TS → JSDoc) require multi-step pipelines
A native solution in quicktype would be simpler, cleaner, and more discoverable.
Context
This feature would be particularly valuable for:
- JavaScript codebases using JSDoc +
@ts-check - environments where TypeScript is intentionally avoided at runtime
- API / message-schema driven systems (e.g. messaging, pub/sub, configuration schemas)
It would make quicktype a best-in-class tool for JSON Schema → JSDoc workflows.