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.

Try changing the `lib` compiler option to es2015 or later

See original GitHub issue

When I try to use ts-json-schema-generator with angular I get an error:

/node_modules/@angular/common/src/directives/ng_class.d.ts(48,34): error TS2583: Cannot find name 'Set'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.
/node_modules/@angular/common/src/pipes/keyvalue_pipe.d.ts(47,9): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.
/node_modules/@angular/common/src/pipes/keyvalue_pipe.d.ts(50,9): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.
...

This error is the same as https://github.com/vega/ts-json-schema-generator/issues/47

To reproduce:

npm install -g @angular/cli
ng new my-app
cd my-app
npm install ts-json-schema-generator
npx ts-json-schema-generator  --path src/main.ts --type string

In the other issue, you propose to use ts-json-schema-generator --path tsconfig.json but in my case I really need to specify the file to search for types. I don’t want ts-json-schema-generator to scan the whole project.

Also, if I copy the node_module outside the project and install the dependency, it is then working.

cp -r  my-app/node_modules/ts-json-schema-generator .
cd ts-json-schema-generator
npm install
npx ts-json-schema-generator  --path ../my-app/src/main.ts --type string

But I need ts-json-schema-generator to be part of the dependency of my project.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
AndrewLeedhamcommented, Jul 22, 2019

@apiel I updated your PR and it was merged as of v0.51.0. So this is now resolved 😃

0reactions
apielcommented, Jun 2, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix compile time errors even using compiler options ...
finally ) and it will eliminate an error message like: Try changing the 'lib' compiler option to 'es2018' or later. The cool thing...
Read more >
How to fix Typescript compiling error (Try changing the 'lib ...
How to fix Typescript compiling error ( Try changing the 'lib' compiler option to 'es2015' or later ).
Read more >
Troubleshoot in ASP.NET MVC Common Component
Try changing the 'lib' compiler option to es2015 or later. Cause: This error is thrown due to not including the required target library...
Read more >
changing the lib compiler to es2017 in Webstorm?
Try changing the 'lib ' compiler option to 'es2017' or later. that is supposed to be done inside of preferences > languages >...
Read more >
TSConfig Option: lib - TypeScript
TypeScript also includes APIs for newer JS features matching the target you specify; for example the ... You may want to change these...
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