Error: type xyz.ts not found
See original GitHub issueToday I installed the latest version via npm install typescript-json-schema -g
.
To test things out, I saved the following file as xyz.ts
:
export interface Foo {
bar: "Baz";
}
I then ran typescript-json-schema xyz.ts *
.
It yielded the following error:
/usr/lib/node_modules/typescript-json-schema/typescript-json-schema.js:667
throw new Error("type " + symbolName + " not found");
^
Error: type xyz.ts not found
at JsonSchemaGenerator.getSchemaForSymbol (/usr/lib/node_modules/typescript-json-schema/typescript-json-schema.js:667:19)
at generateSchema (/usr/lib/node_modules/typescript-json-schema/typescript-json-schema.js:823:32)
at exec (/usr/lib/node_modules/typescript-json-schema/typescript-json-schema.js:853:22)
at Object.run (/usr/lib/node_modules/typescript-json-schema/typescript-json-schema.js:903:5)
at Object.<anonymous> (/usr/lib/node_modules/typescript-json-schema/bin/typescript-json-schema:3:5)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
Although I was not able to get *
to work locally, I was able to get it to work via typescript-json-schema xyz.ts Foo
.
Here is my tsconfig.json
for reference:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": false,
"moduleResolution": "node"
}
}
Thanks for maintaining this very useful library!
EDITS: Typo in filename from previous attempts, updated title to reflect more isolated case.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
TypeScript error - property 'xyz' does not exist on type { }
I have a simple JavaScript function (in a .tsx file) export async function addDealer(payload: object) { let tempSupplierId ...
Read more >How to fix error TS7016: Could not find a declaration file for ...
Try `npm install @types/XYZ` if it exists or add a new declaration (.d.ts) file containing `declare module 'XYZ';. If XYZ is a direct...
Read more >Error "Cannot write file ... because it would overwrite input file."
If tsc runs fine the first time then errors with this error every time after that it's because it doesn't want to overwrite...
Read more >Resolve the "No Export named XYZ found" error in ...
I receive the "No Export named XYZ found" error in AWS CloudFormation when I use Fn::ImportValue in my stack.
Read more >Documentation - TypeScript 3.9
error: Type 'number' is not assignable to type 'string'. That's why TypeScript 3.9 brings a new feature: // @ts-expect-error comments.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone else that may stumble across this, you should place the asterisk inside quotes:
Without the quotes the shell recognizes it as a wildcard and passes each file in the $PWD as an additional argument. Resulting in something like:
I don’t think this is a bug with the software.
Thank you @noahtkeller