运行时错误Visual Studio 2017和Typescript 2.7

时间:2018-04-01 21:06:44

标签: angular typescript

我正在尝试按此链接实现自动完成过滤器示例;

Angular Material Autocomplete

然而,当我尝试运行此操作时,我收到以下错误;

  

[at-loader]中的错误   ./ClientApp/app/components/shared/searchTrade/searchTrade.component.ts:76:13

     

TS2304:找不到姓名' startWith'。 [at-loader]中的错误./ClientApp/app/components/shared/searchTrade/searchTrade.component.ts:77:13

     

TS2552:找不到姓名' map'。你是说' Map'?

searchTrade.component.ts中的相关代码是;

    this.filteredOptions = this.categoriesCtrl.valueChanges
        .pipe(
        startWith(''),
        map(options => options ? this.filter(options) : this.options.slice())
        );

在我的tsconfig.json文件中,我有以下内容;

{
  "compilerOptions": {
    "module": "es6",
    "moduleResolution": "node",
    "target": "es6",
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "skipDefaultLibCheck": true,
    "skipLibCheck": true, // Workaround for https://github.com/angular/angular/issues/17863. Remove this if you upgrade to a fixed version of Angular.
    "strict": false,
    "lib": [ "es6", "dom" ],
    "types": [ "webpack-env" ]
  },
  "exclude": [ "bin", "node_modules" ],
  "atom": { "rewriteTsconfig": false }
}

和我的package.json;

{
  "name": "Bemfeito.Services.Public",
  "private": true,
  "version": "0.0.0",
  "scripts": {
    "test": "karma start ClientApp/test/karma.conf.js"
  },
  "devDependencies": {
    "@angular/animations": "^5.2.9",
    "@angular/cdk": "^5.0.0",
    "@angular/cli": "1.6.3",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/compiler-cli": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/material": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/platform-server": "^5.0.0",
    "@angular/router": "^5.0.0",
    "@ngtools/webpack": "1.10.0-beta.3",
    "@ngx-translate/core": "9.1.1",
    "@ngx-translate/http-loader": "2.0.1",
    "@types/chai": "4.1.2",
    "@types/jasmine": "2.8.6",
    "@types/webpack-env": "1.13.5",
    "angular2-router-loader": "0.3.5",
    "angular2-template-loader": "0.6.2",
    "angular2-useful-swiper": "5.0.1",
    "aspnet-prerendering": "^3.0.1",
    "aspnet-webpack": "^2.0.1",
    "awesome-typescript-loader": "^4.0.1",
    "bootstrap": "4.0.0",
    "chai": "^4.1.2",
    "css": "2.2.1",
    "css-loader": "0.28.9",
    "es6-shim": "0.35.3",
    "event-source-polyfill": "0.0.12",
    "expose-loader": "0.7.4",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "1.1.11",
    "flag-icon-css": "3.0.0",
    "font-awesome": "4.7.0",
    "html-loader": "0.5.5",
    "isomorphic-fetch": "2.2.1",
    "jasmine-core": "2.9.1",
    "jquery": "3.3.1",
    "json-loader": "0.5.7",
    "karma": "^2.0.0",
    "karma-chai": "0.1.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.1",
    "karma-webpack": "^3.0.0",
    "ngx-bootstrap": "2.0.2",
    "ngx-google-places-autocomplete": "2.0.1",
    "ngx-rating": "0.0.9",
    "popper.js": "1.12.9",
    "preboot": "6.0.0-beta.1",
    "raw-loader": "0.5.1",
    "reflect-metadata": "0.1.12",
    "rxjs": "5.5.6",
    "style-loader": "0.20.3",
    "to-string-loader": "1.1.5",
    "tsconfig-paths-webpack-plugin": "^3.0.2",
    "typescript": "2.7.1",
    "url-loader": "0.6.2",
    "webpack": "^3.11.0",
    "webpack-hot-middleware": "^2.21.2",
    "webpack-merge": "4.1.1",
    "zone.js": "0.8.14"
  },
  "dependencies": {}
}

现在我的目标是es6,所以我的方法应该可用吗?请问我可以指导我哪里出错吗?

0 个答案:

没有答案