ОШИБКА в node_modules/@angular/router/router.d.ts (66,9): ошибка TS1086: метод доступа не может быть объявлен в окружающем контексте - PullRequest
1 голос
/ 28 апреля 2020

Итак, я изучал маршрутизацию в angular, и это мой проект, в котором я использую маршрутизацию ... но я сталкиваюсь с этой ошибкой после установки маршрутизации в проект.

Это я получаю сообщение об ошибке:

    ERROR in node_modules/@angular/router/router.d.ts(66,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(68,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(70,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(72,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(74,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(76,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(82,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(87,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(129,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(131,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(133,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(135,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(137,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(138,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(139,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(1925,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2242,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2246,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2248,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2324,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2364,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2365,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2370,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2480,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2481,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2482,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2483,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2772,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2805,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2866,9): error TS1086: An accessor cannot be declared in an ambient context.
    node_modules/@angular/router/router.d.ts(2942,9): error TS1086: An accessor cannot be declared in an ambient context.

пакет. json:

{
  "name": "my-first-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^8.0.0",
    "@angular/common": "~8.0.0",
    "@angular/compiler": "~8.0.0",
    "@angular/core": "^8.2.14",
    "@angular/forms": "~8.0.0",
    "@angular/platform-browser": "~8.0.0",
    "@angular/platform-browser-dynamic": "~8.0.0",
    "@angular/router": "^9.1.3",
    "bootstrap": "3.3.7",
    "core-js": "^3.6.5",
    "rxjs": "^6.5.5",
    "rxjs-compat": "^6.5.5",
    "tslib": "^1.9.0",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.800.0",
    "@angular/cli": "~8.0.0",
    "@angular/compiler-cli": "~8.0.0",
    "@angular/language-service": "~8.0.0",
    "@types/jasmine": "~3.3.12",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~12.0.2",
    "codelyzer": "^5.2.2",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.5.3",
    "protractor": "^5.4.4",
    "ts-node": "~8.1.0",
    "tslint": "~5.11.0",
    "typescript": "3.4.5"
  }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...