I have recently upgraded the version of TypeScript from 2.3.4 to 2.4.0 hoping to use the string enums. To my dismay, however, I have been greeted with the error messages:
This is because typescript version.
Open command prompt or terminal. then run these commands.
Check TypeScript version
tsc -v
should be higher than 2.4
if not.
install latest version of typescript globally
npm install typescript -g
Open your package.json file of the project and change typescript version like this with newly installed version
"typescript": "~2.6.1"
Then delete node_modules folder
Clean cache using
npm cache clean
Finally run
npm install
*Note that: You can update npm using npm update but it is not sure that the typescript version will be updated *