We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For simplicity's sake, I'd like to be able to declare a type that is a union of strings, not a const enum.
const enum
{ "oneOf": [ { "const": "a", "description": "First comment (a)." }, { "const": "b", "description": "Second comment (b)." } ] }
var { compile } = require("json-schema-to-typescript"); var schema = { oneOf: [ { const: "a", description: "First comment (a)." }, { const: "b", description: "Second comment (b)." }, ], }; var pendingResult = compile(schema, "example", { additionalProperties: false, bannerComment: "", declareExternallyReferenced: true, }); pendingResult.then((result) => console.log(result));
export type Example = "a" | "b";
export type Example = /** * First comment (a). */ | "a" /** * Second comment (b). */ | "b";
Is this a reasonable request?
The context, similar to #470, is typescript-eslint rule schemas such as https://typescript-eslint.io/rules/explicit-member-accessibility where we'd like to keep the description to a simple string union, but still document them.
The text was updated successfully, but these errors were encountered:
Emit comments for literal unions (fix #475)
91cd642
0acd2a0
No branches or pull requests
For simplicity's sake, I'd like to be able to declare a type that is a union of strings, not a
const enum
.Quick Node script that compiles the schema...
Actual
Expected
Is this a reasonable request?
The context, similar to #470, is typescript-eslint rule schemas such as https://typescript-eslint.io/rules/explicit-member-accessibility where we'd like to keep the description to a simple string union, but still document them.
The text was updated successfully, but these errors were encountered: