Angular 12 only supports Typescript 4.2.
Angular now uses TypeScript 3.4.
Every now and then it is common to see newer package versions, and TypeScript is not the exception. Hence, the version installed locally might not match the current latest version of the package. To install the latest TypeScript version, add @latest when using the same command to install TypeScript.
Angular 8 supports the TypeScript 3.4 or above version. So, if we want to use Angular 8 for our application, then we need to first upgrade the TypeScript to 3.4 or above.
To fix this install the specific typescript version 3.1.6
npm i [email protected] --save-dev --save-exact
In my case below command worked for windows. It will install latest required version between 3.1.1 and 3.2.0. Depending on OS use either double or single quotes
npm install typescript@">=3.1.1 <3.2.0"
First install your targeted version
npm i [email protected] --save-dev --save-exact
Then before compiling do
npm i
If you want to use Angular with an unsupported TypeScript version, add this to your tsconfig.json
to ignore the warning:
"angularCompilerOptions": {
"disableTypeScriptVersionCheck": true,
},
npm install typescript@">=3.1.1 <3.3.0" --save-dev --save-exact
rm -rf node_modules
npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With