I'm trying to import an external class (written in Typescript) into another Typescript class using requireJS. I used this syntax but I don't understand why I'm getting a syntax error with this import statement:
I have also tried using this instead:
import t = module("Controller/TestController");
And I'm also getting the same error.
The above import/require statement resides in appmod.ts
. This is my file structure:
+Root
+Scripts
+app
-main.ts
-appmod.ts
+Controller
-TestController.ts
I have looked through the documentation, and this line looks perfectly fine to me. The file TestController.ts does exist in the path and the classes are prepended with export keyword.
What's wrong with this line?
This is how my TestController.ts look:
/// <reference path="../typings/angularjs/angular.d.ts" />
module testApp.Controller {
export interface ITestScope extends ng.IScope {
helloString:string;
}
export class TestController {
public static $inject = [
"$scope"
];
constructor(private $scope: ITestScope) {
this.$scope.helloString = "Hello!";
}
}
}
I've used DefinitelyTyped's AngularJS definition in my TestController.js.