6

I'm trying to get TypeScript working with the default Aurelia skeleton, which is based on System.JS as a loader.

I'm having trouble getting TypeScript to accept module imports. I renamed one of the skeleton files, "nav-bar.js" to "nav-bar.ts" to see if I could convert the example into TypeScript. The code results in a compiler error: "Error:(5, 24) TS2307: Cannot find external module 'aurelia-framework'."

import {bindable} from "aurelia-framework";

export class NavBar {
  //noinspection ES6Validation
  @bindable router = null;
}

How can I get TypeScript to see the aurelia-framework as a valid import? There's a file in the root of the project called config.js that seems to describe the specific location of "aurelia-framework" but TypeScript doesn't know how to load it.

Thanks in advance for your help.

1 Answer 1

5

You may want to use d.ts definition files for registration with TypeScript Definitely Typed registry for use with tsd package manager. You can find different implementations on github, for example here or here. Also this tutorial might be useful.

Sign up to request clarification or add additional context in comments.

2 Comments

To add, we will be adding official .d.ts files in our next set of major releases.
The links have useful info - there's apparently a tsconfig.json file that I think defines locations like "aurelia-framework". However, the links you've provided have definitions that precedes the latest Aurelia release on June 9th. Is someone planning to update the definitions to the current Aurelia release? Or should I be using the old definitions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.