“error TS2694: Namespace 'angular' has no exported member 'xxx'” after upgrading @types/angular

后端 未结 3 1506
孤街浪徒
孤街浪徒 2021-01-13 08:54

After upgrading angular and @types/angular version to version 1.6.x I have lots of TS2694 errors:

error TS2694: Namespace \'angular\' has no exported member          


        
3条回答
  •  终归单人心
    2021-01-13 09:50

    Manually editing the file like in the accepted answer above caused some issues for me.

    Running "yarn upgrade" or altering some packages would revert the manually edited change and my app would be broken again.

    To fix this I added a resolution to package.json which fixes the issue of resolving different versions.

    "resolutions": {
      "**/@types/angular": "1.6.20"
     },
    

提交回复
热议问题