diff --git a/README.md b/README.md index 021428c..3586ba6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/typescript-json-schema-cli.ts b/typescript-json-schema-cli.ts index 9741862..c1bb17b 100644 --- a/typescript-json-schema-cli.ts +++ b/typescript-json-schema-cli.ts @@ -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") @@ -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, diff --git a/typescript-json-schema.ts b/typescript-json-schema.ts index 86f3872..8471203 100644 --- a/typescript-json-schema.ts +++ b/typescript-json-schema.ts @@ -49,6 +49,7 @@ export function getDefaultArgs(): Args { strictNullChecks: false, esModuleInterop: false, skipLibCheck: false, + experimentalDecorators: true, ignoreErrors: false, out: "", validationKeywords: [], @@ -81,6 +82,7 @@ export type Args = { esModuleInterop: boolean; skipLibCheck: boolean; ignoreErrors: boolean; + experimentalDecorators: boolean; out: string; validationKeywords: string[]; include: string[]; @@ -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); }