visual studio 2015 asp.net 5 aurelia, typescript 编译错误

visual studio 2015 asp.net 5 aurelia, typescript compilation errors

我正在尝试开始 asp.net 6 Aurelia 项目。 我做了以下

  1. 安装了 nodegit 并将它们添加到我的路径中。
  2. 已安装jspm
  3. 创建了一个空的 asp.net 5 项目。
  4. 运行 jspm init 在 web 项目的根目录中,并指定 Enter server baseURL (public folder path) [./]:wwwroot
  5. 运行 jspm install aurelia-bootstrapper, jspm install aurelia-framework, jspm install core-js

现在,如果我尝试编译该项目,我会收到 106 个 TypeScript 错误,它看起来像是添加到 wwwroot/jspm_packages/npm/... 下的一些 .ts 文件,但它们无法编译。

有没有办法告诉 ts 编译器忽略这些文件?

前 10 个错误:

您必须配置 typescript 编译以排除 wwwroot/jspm_packages。在您的 tsconfig.json 中添加以下内容:

{
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "module": "system"
  },
  "exclude": ["wwwroot/jspm_packages"]
}

我找到了以下文章http://www.marwijnchristiaans.com/?p=6

添加以下文件:

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true
  }
}

es6.d.ts

core-js.d.ts

declare module 'core-js' {
    var core: any;
    export default core
}

然后就成功了!