'typescript upgrade 1.8.10 to 2.9.2 and 4.6.4 build error

I have an angular application, using typescript 1.8.10 and working fine. I like to try and upgrade typescript from 1.8.10 to 2.9.2. Once I change this setting in package.json and run npm install I get a lot of errors. Is there anything I need to do to use this version?

Version 2.9.2 Error

Severity Code Description File Project Line Suppression State Error Build:',' expected. C:\WebProjects\ITF\Web\node_modules\typescript\lib\lib.es6.d.ts

Update I tried to update typescript to 4.6.4 but I am getting a different error about the same file

Version 4.6.4 Error

Severity Code Description File Project Line Suppression State Error Build:Invalid 'reference' directive syntax. C:\WebProjects\ITF\Web\node_modules\typescript\lib\lib.es6.d.ts



Solution 1:[1]

Invalid 'reference' show when the package path is missing, or something's wrong with it. Deleting the entire node_modules folder and reinstall them with your package manager (npm or yarn).

npm install

If that doesn't work, I would suggest you to update your dependencies.

https://github.com/DefinitelyTyped/DefinitelyTyped/issues/10097

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MD. RAKIB HASAN