Search code examples
angulartypescriptvega-lite

How to fix issue of incompatibility between angular project and a vega (charts library)?


I'm currently working on a angular 7 project, and i want to add vega library for charts. the issue i think is the fact that vega requires a higher version of typescript (3.4.4) and inside my project its only (3.2.2).

So when i try to run the project, i'm having an error like this :

ERROR in node_modules/vega-lite/build/src/util.d.ts(1,10): error TS2305: Module '"P:/projects/ui/project/node_modules/@types/clone"' has no exported member 'default'. node_modules/vega-lite/build/src/util.d.ts(2,8): error TS1192: Module '"P:/projects/ui/project/node_modules/@types/fast-json-stable-stringify/index"' has no default export.

so could be please give me an idea , how to solve this kind of issues , if you have lower version of typescript in your application and a higher one in another library.

thank you


Solution

  • Angular 7 currently uses TypeScript 3.2.2 so your Angular TypeScript version is as expected.

    You could manually try changing the version of TypeScript in package.json then do an npm install and see what happens. If it errors out then it's going to be a problem for you.

    Another suggestion is you could switch to the release candidate for Angular 8.

    Run this ...

    npm view @angular/cli versions --json
    

    Currently it shows there is a version 8 release candidate available called 8.0.0-rc.2

    So you could do

    npm i -g @angular/cli@8.0.0-rc.2
    

    and then create a new project and see if Angular 8 is using a newer version of TypeScript. If so you could copy your code to the new Angular 8 project or you could wait for the release of Angular 8 which is expected very soon (May 2019) and then just use

    ng update 
    

    to upgrade to 8.

    Alternatively, downgrade vega or look for a different library.