Open Ririshi opened 3 years ago
Hmm, is that a problem in my library or with typescript-patch
or typescript
?
Ah, fair enough. I forgot to add the first part of the error message:
.../.yarn/cache/ts-json-schema-generator-npm-0.83.2-d9cde4e2b0-96c34d8aef.zip/node_modules/ts-json-schema-generator/dist/factory/parser.d.ts(1,8): <original part of the error in OP>
It does seem to be happening inside a ts-json-schema-generator
file.
You should not need the d.ts file. Instead, just use the javascript cli bundle. If you want to use the library, enable esModuleInterop.
This is the error I get when running ts-json-schema-generator -f tsconfig.json -t ConfigJson -o configSchema.json
...
And with esModuleInterop
it works?
It works yes. I do get a different error specific to my configuration, but that's not in the scope of this ticket.
Then I expect esModuleInterop to be set. If that doesn't work for you, please send a pull request.
I was receiving the same error when running:
ts-json-schema-generator --path 'my/project/**/*.ts' --type 'My.Type.Name'
The script does not pick up tsconfig.json
by default.
Adjusting the command to pass in the config fixed the issue:
ts-json-schema-generator -f tsconfig.json --path 'my/project/**/*.ts' --type 'My.Type.Name'
Calling
ts-json-schema-generator
whileesModuleInterop
is disabled in the providedtsconfig.json
causes an error:I initially thought it was happening because I am using Yarn 2, but I am not sure if that is indeed the cause.