VS Code Typescript intellisense报告不存在的错误

Jos*_* M. 5 intellisense typescript visual-studio-code

我正在使用VS Code v1.4.0,Typescript v1.8.10.

VS Code intellisense抱怨我的一些导入的模块不存在.但是,我有所需的打字,并配置tsconfig.json如下所示.

示例类

import {inject} from 'aurelia-framework';
import {EventAggregator} from 'aurelia-event-aggregator';
import {UserService} from '../services/UserService';
import {OperatorService} from '../services/OperatorService';

@inject(EventAggregator, UserService, OperatorService)
export class AuthContext {
    // ...

    public initialize(): Promise<boolean> {
        // ...
    }
}
Run Code Online (Sandbox Code Playgroud)

在这个类中,intellisense给出了以下错误:

  • 找不到模块'aurelia-framework','aurelia-event-aggregator'.
  • 对装饰器的实验支持是一项功能...设置'experimentalDecorators'选项以删除此警告.
  • 找不到名字'承诺'.

不能显示"找不到模块"错误,因为我已经定义了类型(见下文).

"实验装饰器"错误不应该出现,因为我已经启用了此选项tsconfig.json.

"找不到承诺"错误不应该出现,因为我已经添加了es6-shim输入.

typings.json

{
  "name": "my-project",
  "dependencies": {
    "aurelia-binding": "github:aurelia/binding",
    "aurelia-bootstrapper": "github:aurelia/bootstrapper",
    "aurelia-dependency-injection": "github:aurelia/dependency-injection",
    "aurelia-dialog": "github:aurelia/dialog",
    "aurelia-event-aggregator": "github:aurelia/event-aggregator",
    "aurelia-fetch-client": "github:aurelia/fetch-client",
    "aurelia-framework": "github:aurelia/framework",
    "aurelia-history": "github:aurelia/history",
    "aurelia-history-browser": "github:aurelia/history-browser",
    "aurelia-loader": "github:aurelia/loader",
    "aurelia-logging": "github:aurelia/logging",
    "aurelia-logging-console": "github:aurelia/logging-console",
    "aurelia-metadata": "github:aurelia/metadata",
    "aurelia-pal": "github:aurelia/pal",
    "aurelia-pal-browser": "github:aurelia/pal-browser",
    "aurelia-path": "github:aurelia/path",
    "aurelia-polyfills": "github:aurelia/polyfills",
    "aurelia-route-recognizer": "github:aurelia/route-recognizer",
    "aurelia-router": "github:aurelia/router",
    "aurelia-task-queue": "github:aurelia/task-queue",
    "aurelia-templating": "github:aurelia/templating",
    "aurelia-templating-binding": "github:aurelia/templating-binding",
    "aurelia-templating-resources": "github:aurelia/templating-resources",
    "aurelia-templating-router": "github:aurelia/templating-router"
  },
  "globalDependencies": {
    "es6-shim": "registry:dt/es6-shim#0.31.2+20160602141504",
    "jquery": "registry:dt/jquery#1.10.0+20160704162008",
    "materialize-css": "registry:dt/materialize-css#0.97.5+20160628040906",
    "moment-node": "registry:dt/moment-node#2.11.1+20160511043338",
    "url": "github:aurelia/fetch-client/doc/url.d.ts#bbe0777ef710d889a05759a65fa2c9c3865fc618",
    "whatwg-fetch": "registry:dt/whatwg-fetch#0.0.0+20160524142046"
  },
  "devDependencies": {}
}
Run Code Online (Sandbox Code Playgroud)

tsconfig.json

{
  "version": "1.8.10",
  "compileOnSave": true,
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "dist",
    "sourceMap": true,
    "target": "es5",
    "module": "amd",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "lib": ["es2015", "dom"]
  },
  "filesGlob": [
    "./src/**/*.ts",
    "./test/**/*.ts",
    "./typings/index.d.ts",
    "./typings/custom/**/*.d.ts",
    "./jspm_packages/**/*.d.ts"
  ],
  "exclude": [
    "node_modules",
    "jspm_packages"
  ]
}
Run Code Online (Sandbox Code Playgroud)