TS1086: An accessor cannot be declared in ambient context

前端 未结 12 1541
自闭症患者
自闭症患者 2021-02-01 12:16

I have a thousands of this error after initial implementation nad typing in terminal ng serve my-app of and i can\'t resolve it. This is first time for me when i have problem li

相关标签:
12条回答
  • 2021-02-01 12:40

    I think that your problem was emerged from typescript and module version mismatch.This issue is very similar to your question and answers are very satisfying.

    0 讨论(0)
  • 2021-02-01 12:41

    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/flex-layout@8.0.0-beta.27 --save
    
    0 讨论(0)
  • 2021-02-01 12:42

    Setting "skipLibCheck": true in tsconfig.json solved my problem

    "compilerOptions": {
        "skipLibCheck": true
    }
    
    0 讨论(0)
  • 2021-02-01 12:43

    In my case, mismatch of version of two libraries.

    I am using angular 7.0.0 and installed

    "@swimlane/ngx-dnd": "^8.0.0"
    

    and this caused the problem. Reverting this library to

    "@swimlane/ngx-dnd": "6.0.0"
    

    worked for me.

    0 讨论(0)
  • 2021-02-01 12:45

    Looks like you have recently installed flex-layout package. Try removing this package folder from your node_modules folder and reinstalling previous version of this package.

    Recently (2 days before current date), angular released latest angular-cli version (v9.0.1) due to which many packages are updated to support this latest cli version. In your case you might have old cli version and when you installed this package it was downloaded for latest cli version by default. So try downgrading your package version. Worked for me atleast.

    Also, dont forget to downgrade the version of your package in package.json file

    0 讨论(0)
  • 2021-02-01 12:49

    In my case downgrading @angular/animations worked, if you can afford to do that, run the command

    npm i @angular/animations@6.1.10
    

    Or use another version that might work for you from the Versions tab here: https://www.npmjs.com/package/@angular/animations

    0 讨论(0)
提交回复
热议问题