TS1086: An accessor cannot be declared in ambient context
Setting "skipLibCheck": true
in tsconfig.json
solved my problem
"compilerOptions": {
"skipLibCheck": true
}
I had this same issue, and these 2 commands saved my life. My underlying problem is that I am always messing up with global install and local install. Maybe you are facing a similar issue, and hopefully running these commands will solve your problem too.
ng update --next @angular/cli --force
npm install typescript@latest
If it's just a library that's causing this, this will avoid the problem just fine. Typescript can be a pain on the neck sometimes so set this value on your tsconfig.json file.
"compilerOptions": {
"skipLibCheck": true
}
I got the same issue when adding @angular/flex-layout to my Angular 8 project now with
`npm install @angular/flex-layout --save`.
This since now that command installed the major 9th version of the flex-layout package. Instead of upgrading everything else to the last version, I solved it by installing the last 8th major version of the package instead.
npm install @angular/[email protected] --save
Quick solution: Update package.json
"devDependencies": {
...
"typescript": "~3.7.4",
}
In tsconfig.json
{
...,
"angularCompilerOptions": {
...,
"disableTypeScriptVersionCheck": true
}
}
then remove node_modules folder and reinstall with
npm install
For more visit here