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.
TypeScript supports the following 4 Modules: commonjs, amd, system and umd.
The allowJs setting allows JavaScript files to be imported inside your TypeScript files.To import a JavaScript file into a TypeScript file: Set allowJs to true in your tsconfig. json file. Import named exports as import { getEmployee } from './employee' .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With