I have a problem that I suppose comes from my ASP.NET MVC project using Type Script. For testing I have created a project using the HTML TypeScript template. I could perfectly create two modules and use one of them in the other like this:
import authModule = module("Authenticate");
import testModule = module("TestModule");
export module SiteMaster {
authModule.Authenticate.run();
testModule.TestModule.run();
}
It is generating correctly the JavaScript like this:
define(["require", "exports", "Authenticate", "TestModule"], function(require, exports, __authModule__, __testModule__) {
var authModule = __authModule__;
var testModule = __testModule__;
(function (SiteMaster) {
authModule.Authenticate.run();
testModule.TestModule.run();
})(exports.SiteMaster || (exports.SiteMaster = {}));
})
Then I have copied to my ASP.NET MVC 4.5 the compiler command from my Typescript project.
<Target Name="BeforeBuild">
<Exec Command=""$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc" --module amd @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
It is compiling correctly. Apparently is compiling correctly.
But there is a problem: when I create the same modules in my ASP.NET MVC application I receive the compilation errors in the import line:
The name '"Authenticate"' does not exist in the current scope
A module cannot be aliased to a non-module
Ths same for TestModule.
I have included a reference below to the module and the error remains, and look in the Typescript template the reference was not necessary.
/// <reference path='Authenticate.ts'/>
What is wrong here?