Skip to content
New issue

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

Add support for experimentalDecorators ts option. To use with TS5 decorators #606

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Options:
--defaultNumberType Default number type. [choices: "number", "integer"] [default: "number"]
--tsNodeRegister Use ts-node/register (needed for require typescript files). [boolean] [default: false]
--constAsEnum Use enums with a single value when declaring constants. [boolean] [default: false]
--experimentalDecorators Use experimentalDecorators when loading typescript modules.
[boolean] [default: true]
```

### Programmatic use
Expand Down
3 changes: 3 additions & 0 deletions typescript-json-schema-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export function run() {
.describe("esModuleInterop", "Use esModuleInterop when loading typescript modules.")
.boolean("skipLibCheck").default("skipLibCheck", defaultArgs.skipLibCheck)
.describe("skipLibCheck", "Use skipLibCheck when loading typescript modules.")
.boolean("experimentalDecorators").default("experimentalDecorators", defaultArgs.experimentalDecorators)
.describe("skipLibCheck", "Use experimentalDecorators when loading typescript modules.")
.boolean("ignoreErrors").default("ignoreErrors", defaultArgs.ignoreErrors)
.describe("ignoreErrors", "Generate even if the program has errors.")
.alias("out", "o")
Expand Down Expand Up @@ -70,6 +72,7 @@ export function run() {
strictNullChecks: args.strictNullChecks,
esModuleInterop: args.esModuleInterop,
skipLibCheck: args.skipLibCheck,
experimentalDecorators: args.experimentalDecorators,
ignoreErrors: args.ignoreErrors,
out: args.out,
validationKeywords: args.validationKeywords,
Expand Down
4 changes: 4 additions & 0 deletions typescript-json-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function getDefaultArgs(): Args {
strictNullChecks: false,
esModuleInterop: false,
skipLibCheck: false,
experimentalDecorators: true,
ignoreErrors: false,
out: "",
validationKeywords: [],
Expand Down Expand Up @@ -81,6 +82,7 @@ export type Args = {
esModuleInterop: boolean;
skipLibCheck: boolean;
ignoreErrors: boolean;
experimentalDecorators: boolean;
out: string;
validationKeywords: string[];
include: string[];
Expand Down Expand Up @@ -1833,6 +1835,8 @@ export async function exec(filePattern: string, fullTypeName: string, args = get
strictNullChecks: args.strictNullChecks,
esModuleInterop: args.esModuleInterop,
skipLibCheck: args.skipLibCheck,
emitDecoratorMetadata: args.experimentalDecorators,
experimentalDecorators: args.experimentalDecorators,
});
onlyIncludeFiles = onlyIncludeFiles.map(normalizeFileName);
}
Expand Down
Loading