Search code examples
angularin-memory-database

ERROR in node_modules/angular-in-memory-web-api/backend.service.d.ts(18,19): error TS1086: An accessor cannot be declared in an ambient context


I got this error after installed 'angular-in-memory-web-api'.

import { InMemoryDbService } from "angular-in-memory-web-api";

and I got these error

ERROR in node_modules/angular-in-memory-web-api/backend.service.d.ts(18,19): error TS1086: An accessor cannot be declared in an ambient context.

This is my packge.json

 {
  "name": "customer-order-manager",
  "version": "1.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build-prod": "ng build --prod",
    "odin-build": "odin build"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.1.0",
    "@angular/cdk": "~7.1.0",
    "@angular/common": "~7.1.0",
    "@angular/compiler": "~7.1.0",
    "@angular/core": "~7.1.0",
    "@angular/forms": "~7.1.0",
    "@angular/material": "~7.1.0",
    "@angular/platform-browser": "~7.1.0",
    "@angular/platform-browser-dynamic": "~7.1.0",
    "@angular/router": "~7.1.0",
    "@auth0/angular-jwt": "^3.0.0",
    "@ng-bootstrap/ng-bootstrap": "~4.1.0",
    "@progress/kendo-angular-buttons": "^5.2.3",
    "@progress/kendo-angular-common": "^1.0.0",
    "@progress/kendo-angular-dateinputs": "^4.0.0",
    "@progress/kendo-angular-dialog": "^4.1.3",
    "@progress/kendo-angular-dropdowns": "^4.0.0",
    "@progress/kendo-angular-excel-export": "^3.0.0",
    "@progress/kendo-angular-grid": "^4.6.4",
    "@progress/kendo-angular-inputs": "^6.0.0",
    "@progress/kendo-angular-intl": "^2.0.0",
    "@progress/kendo-angular-l10n": "^2.0.0",
    "@progress/kendo-angular-layout": "^4.2.2",
    "@progress/kendo-angular-pdf-export": "^2.0.0",
    "@progress/kendo-angular-popup": "^3.0.0",
    "@progress/kendo-data-query": "^1.0.0",
    "@progress/kendo-drawing": "^1.5.12",
    "@progress/kendo-theme-default": "latest",
    "angular-2-dropdown-multiselect": "^1.9.0",
    "angular-in-memory-web-api": "^0.10.0",
    "angular-oauth2-oidc": "^8.0.4",
    "angular-oauth2-oidc-codeflow": "^4.0.1",
    "bootstrap": "~4.0.0",
    "core-js": "^2.5.4",
    "datepicker-bootstrap": "^1.9.13",
    "file-saver": "^2.0.2",
    "hammerjs": "^2.0.8",
    "highlight.js": "^9.14.2",
    "jquery": "^3.4.1",
    "lodash": "^4.17.15",
    "moment": "^2.24.0",
    "ngx-cookie-service": "^2.2.0",
    "ngx-mask": "^8.1.6",
    "ngx-pagination": "^4.1.0",
    "numeric-formatter": "^1.0.5",
    "odin": "0.0.10",
    "popper": "1.0.1",
    "popper.js": "^1.15.0",
    "primeicons": "^2.0.0",
    "primeng": "^8.1.1",
    "rxjs": "~6.3.3",
    "ts-xlsx": "0.0.11",
    "ts-xlsx-export": "^1.0.1",
    "tslib": "^1.9.0",
    "xlsx": "^0.15.1",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular/cli": "^7.1.4",
    "@angular/compiler-cli": "~7.1.0",
    "@angular/language-service": "~7.1.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "2.0.3",
    "@types/lodash": "^4.14.149",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.6"
  }
}

Solution

  • I found the solution. I fixed the issue by downgrading the

    angular-in-memory-web-api

    module in to

    0.9.0

    Because 0.10.0 was not compatible with the typescript version.

    Open for suggestions...