4

我在 Visual Studio 中有一个 TypeScript 项目,通过 systemjs 安装了模块。我有以下代码:

应用程序.ts

import { Aurelia } from 'aurelia-framework';

例如,悬停 Aurelia 并按 F12(转到定义)会打开aurelia-framework.d.tssystemjs 安装的正确文件。但是,当我单击构建时,我得到以下输出:

error TS2307: Build: Cannot find module 'aurelia-router'.

这是我的 tsconfig 供参考。

tsconfig.json

{
  "version": "1.8.0",
  "compilerOptions": {
    "rootDir": "src/",
    "outDir": "dist/",
    "target": "es5",
    "module": "system",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  }
}
4

1 回答 1

1

答案似乎是在你的 aurelia 应用程序的根目录中添加一个文件 - 我叫我的 typings.d.ts - /src 或任何你称之为的文件 - 带有一个对 index.d 的 /// 引用。 ts 文件在您的类型文件夹中。

然后一切都很好。

于 2017-03-31T09:07:54.260 回答