Visual Studio locates systemjs typescript definitions, but cannot locate them on compile

434 views Asked by At

I have a TypeScript project in Visual Studio, with modules installed via systemjs. I have the following code:

app.ts

import { Aurelia } from 'aurelia-framework';

For example, hovering Aurelia and pressing F12 (Go to Definition) opens up the correct aurelia-framework.d.ts file installed by systemjs. However, when I click Build, I get the following output:

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

Here is my tsconfig for reference.

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
  }
}
1

There are 1 answers

0
Rich Bryant On

The answer appears to be to add a file - I call mine typings.d.ts - in the root of your aurelia app - /src or whatever you've called it - with a single /// reference to the index.d.ts file in your typings folder.

Then everything plays nice.