question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: type xyz.ts not found

See original GitHub issue

Today 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:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

6reactions
noahtkellercommented, Feb 3, 2018

For anyone else that may stumble across this, you should place the asterisk inside quotes:

$ typescript-json-schema tsconfig.json "*"

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:

$ typescript-json-schema tsconfig.json somefile.js someotherfile.js anotherfile.js

I don’t think this is a bug with the software.

0reactions
domoritzcommented, Feb 3, 2018

Thank you @noahtkeller

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found