为什么我遇到这些Typescript编译时错误?

时间:2019-01-19 10:32:59

标签: .net node.js angular typescript single-page-application

我不知道为什么会出现这些错误,而我是从不存在这些错误的正在运行的应用程序中复制整个ClientApp文件夹的。

enter image description here

我的项目结构是;

enter image description here

这是我的package.json:

{
  "name": "crossvertise-calander-system",
  "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": "^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",
    "core-js": "^2.5.7",
    "rxjs": "^6.3.3",
    "saturn-datepicker": "^7.0.1",
    "@angular/http": "7.1.4",
    "@ng-bootstrap/ng-bootstrap": "4.0.1",
    "bootstrap": "4.1.3",
    "hammerjs": "^2.0.8",
    "jquery": "^3.3.1",
    "md-date-range-picker": "^0.8.3",
    "ng2-daterange-picker": "^1.1.0",
    "ngx-mat-daterange-picker": "0.0.2",
    "rxjs-compat": "^6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26",
    "@mat-datetimepicker/core": "3.0.0-beta.0",
    "@mat-datetimepicker/moment": "3.0.0-beta.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.11.0",
    "@angular/cli": "~7.1.3",
    "@angular/compiler-cli": "~7.1.0",
    "@angular/language-service": "~7.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/jquery": "^3.3.27",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "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"
  }
}

任何人都可以帮助我如何摆脱这些错误。我不知道如何避免这些错误。这些真的减慢了我的发展速度

1 个答案:

答案 0 :(得分:1)

请遵循以下步骤:

  • 删除您的node_modules文件夹和package-lock.json文件(如果存在)
  • 运行npm install命令

如果这仍然不能解决问题,则在您的spec.ts文件中,添加以下导入:

import {} from 'jasmine';