Angular 7 (An accessor cannot be declared in an ambient context)

Hello. I’m quite new to Angular and when

I try to build --prod my angular apps, I get this errors:

ERROR in node_modules/@builder.io/sdk/dist/src/classes/observable.class.d.ts(7,9 ): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(301,16): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(302,16): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(308,16): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(322,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(323,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(324,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(328,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(329,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(331,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(332,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(360,17): error TS1086: An accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(367,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(368,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(380,9): error TS1086: A n accessor cannot be declared in an ambient context. node_modules/@builder.io/sdk/dist/src/builder.class.d.ts(407,9): error TS1086: A n accessor cannot be declared in an ambient context.

Here is my package.json:

“dependencies”: {

"@agm/core": "1.0.0-beta.2",

"@angular-devkit/build-angular": "^0.13.10",

"@angular-material-extensions/password-strength": "^3.6.1",

"@angular/animations": "7.0.4",

"@angular/cdk": "7.0.4",

"@angular/common": "7.0.4",

"@angular/compiler": "7.0.4",

"@angular/core": "7.0.4",

"@angular/flex-layout": "7.0.0-beta.19",

"@angular/forms": "7.0.4",

"@angular/http": "7.0.4",

"@angular/material": "7.0.4",

"@angular/platform-browser": "7.0.4",

"@angular/platform-browser-dynamic": "7.0.4",

"@angular/router": "7.0.4",

"@builder.io/angular": "^1.1.20",

"@fortawesome/angular-fontawesome": "^0.3.0",

"@fortawesome/fontawesome-svg-core": "^1.2.32",

"@fortawesome/free-brands-svg-icons": "^5.15.1",

"@fortawesome/free-solid-svg-icons": "^5.15.1",

"@ng-bootstrap/ng-bootstrap": "^4.1.1",

"@ngu/carousel": "^1.5.5",

"@ngx-translate/core": "10.0.1",

"@ngx-translate/http-loader": "3.0.1",

"@swimlane/ngx-datatable": "11.1.7",

"@yellowspot/ng-truncate": "^1.5.1",

"angular-calendar": "0.26.4",

"angular-font-awesome": "^3.1.2",

"angular-in-memory-web-api": "0.7.0",

"angular-star-rating": "3.0.8",

"animate.css": "^3.7.2",

"bootstrap": "^4.3.1",

"chart.js": "2.5.0",

"classlist.js": "1.1.20150312",

"core-js": "2.4.1",

"country-state-city": "^1.0.2",

"css-star-rating": "1.2.4",

"date-fns": "1.28.5",

"font-awesome": "^4.7.0",

"gsap": "^3.2.6",

"hammerjs": "2.0.8",

"hopscotch": "0.3.1",

"imports-loader": "^0.8.0",

"jquery": "^3.5.1",

"mdbootstrap": "^4.17.0",

"moment": "^2.25.1",

"ng2-charts": "1.6.0",

"ng2-dragula": "1.3.1",

"ng2-file-upload": "1.2.1",

"ng2-validation": "4.2.0",

"ngx-color-picker": "5.3.8",

"ngx-infinite-scroll": "^7.1.0",

"ngx-owl-carousel-o": "^1.2.0",

"ngx-pagination": "3.1.0",

"ngx-perfect-scrollbar": "6.1.0",

"ngx-quill": "2.0.4",

"parallax-js": "^3.1.0",

"perfect-scrollbar": "1.4.0",

"rxjs": "6.1.0",

"rxjs-compat": "6.1.0",

"scrollmagic": "^2.0.7",

"web-animations-js": "2.3.1",

"zone.js": "0.8.26"

},

“devDependencies”: {

"@angular-devkit/core": "^7.3.10",

"@angular/cli": "7.0.4",

"@angular/compiler-cli": "^7.2.11",

"@angular/language-service": "7.0.4",

"@angular/material-moment-adapter": "^9.2.4",

"@types/hopscotch": "0.2.28",

"@types/jasmine": "2.5.38",

"@types/node": "6.0.60",

"codelyzer": "~2.0.0",

"copy-webpack-plugin": "4.3.0",

"enhanced-resolve": "3.3.0",

"jasmine-core": "~2.5.2",

"jasmine-spec-reporter": "~3.2.0",

"karma": "~1.4.1",

"karma-chrome-launcher": "~2.1.1",

"karma-cli": "~1.0.1",

"karma-coverage-istanbul-reporter": "~0.2.0",

"karma-jasmine": "~1.1.0",

"karma-jasmine-html-reporter": "~0.2.2",

"node-sass": "^4.13.1",

"protractor": "~5.1.0",

"ts-node": "2.0.0",

"tslint": "4.5.0",

"typescript": "3.1.6"

}

If you could create a CodeSandbox with some minimal code that reproduces/triggers the problem and send the link to us, that could help us a lot when debugging the error. Thanks!

Hi there! Just wanted to follow-up and see if we could still help in any way.

Hi! i’m Having the same issue with a free account a fresh install of angular:

Angular 8

If you could create a CodeSandbox with some minimal code that reproduces/triggers the problem and send the link to us, that could help us a lot when debugging the error. Thanks!

image
I experienced the same in Angular 8 (still the default for the ASP.NET (.NET 5) Angular template, unfortunately). You can add this command to your tsconfig.json and it resolves (read: ignores) it.

Or better yet, upgrade to Angular 11 and there are no such errors.