Skip to content

Commit acc0c45

Browse files
krizkakriz
and
kriz
authored
Add support for experimentalDecorators ts option. To use with TS5 decorators (YousefED#606)
Co-authored-by: kriz <[email protected]>
1 parent 1bbf4a9 commit acc0c45

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Options:
5252
--defaultNumberType Default number type. [choices: "number", "integer"] [default: "number"]
5353
--tsNodeRegister Use ts-node/register (needed for require typescript files). [boolean] [default: false]
5454
--constAsEnum Use enums with a single value when declaring constants. [boolean] [default: false]
55+
--experimentalDecorators Use experimentalDecorators when loading typescript modules.
56+
[boolean] [default: true]
5557
```
5658

5759
### Programmatic use

typescript-json-schema-cli.ts

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export function run() {
3232
.describe("esModuleInterop", "Use esModuleInterop when loading typescript modules.")
3333
.boolean("skipLibCheck").default("skipLibCheck", defaultArgs.skipLibCheck)
3434
.describe("skipLibCheck", "Use skipLibCheck when loading typescript modules.")
35+
.boolean("experimentalDecorators").default("experimentalDecorators", defaultArgs.experimentalDecorators)
36+
.describe("skipLibCheck", "Use experimentalDecorators when loading typescript modules.")
3537
.boolean("ignoreErrors").default("ignoreErrors", defaultArgs.ignoreErrors)
3638
.describe("ignoreErrors", "Generate even if the program has errors.")
3739
.alias("out", "o")
@@ -70,6 +72,7 @@ export function run() {
7072
strictNullChecks: args.strictNullChecks,
7173
esModuleInterop: args.esModuleInterop,
7274
skipLibCheck: args.skipLibCheck,
75+
experimentalDecorators: args.experimentalDecorators,
7376
ignoreErrors: args.ignoreErrors,
7477
out: args.out,
7578
validationKeywords: args.validationKeywords,

typescript-json-schema.ts

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function getDefaultArgs(): Args {
4949
strictNullChecks: false,
5050
esModuleInterop: false,
5151
skipLibCheck: false,
52+
experimentalDecorators: true,
5253
ignoreErrors: false,
5354
out: "",
5455
validationKeywords: [],
@@ -81,6 +82,7 @@ export type Args = {
8182
esModuleInterop: boolean;
8283
skipLibCheck: boolean;
8384
ignoreErrors: boolean;
85+
experimentalDecorators: boolean;
8486
out: string;
8587
validationKeywords: string[];
8688
include: string[];
@@ -1833,6 +1835,8 @@ export async function exec(filePattern: string, fullTypeName: string, args = get
18331835
strictNullChecks: args.strictNullChecks,
18341836
esModuleInterop: args.esModuleInterop,
18351837
skipLibCheck: args.skipLibCheck,
1838+
emitDecoratorMetadata: args.experimentalDecorators,
1839+
experimentalDecorators: args.experimentalDecorators,
18361840
});
18371841
onlyIncludeFiles = onlyIncludeFiles.map(normalizeFileName);
18381842
}

0 commit comments

Comments
 (0)