While I am aware that using TypeScript outFile is generally advised against, I currently have no choice but to utilize it until a more suitable solution like AMD can be implemented.
It seems like there may be a "module splitting issue" in my project. In the same directory, I have two files:
Contents of referencedFile.ts:
module my.namespace {
export class one {
}
export class two {
}
}
Contents of anotherClass.ts:
module my.namespace {
export class anotherClass {
constructor() {
// Error message: "JavaScript runtime error: Object doesn't support this action"
var x = new my.namespace.one();
}
}
}
Upon runtime, the error "Object doesn't support this action" occurs when attempting to create a new instance of the "one" class. Upon further investigation within the constructor of anotherClass, it appears that my.namespace.one and my.namespace.two are not accessible at that point.
I tried adding the following line at the top of anotherClass.ts, but it did not resolve the issue:
/// <reference path="referencedFile.ts" />
In my Visual Studio TypeScript settings, I have "Combine Javascript output into one file" set to "Scripts\oneFile.js". Checking the generated "oneFile.js", I can confirm that the code from referencedFile.ts exists before the code from anotherClass.js, so it seems like there shouldn't be an ordering problem.
What could be causing this discrepancy?