Skip to content

Commit

Permalink
Add support for experimentalDecorators ts options. To use with TS5 de…
Browse files Browse the repository at this point in the history
…corators proposal 3
  • Loading branch information
kriz committed Jun 5, 2024
1 parent 1bbf4a9 commit 33193b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
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

0 comments on commit 33193b5

Please sign in to comment.