I know that the TypeScript outFile usage is not recommended.
But I am forced to use it until I have time to implement a better solution such as AMD.
I believe I am having a "module splitting issue". I have two files in the same directory:
File referencedFile.ts:
module my.namespace {
export class one {
}
export class two {
}
}
File anotherClass.ts:
module my.namespace {
export class anotherClass {
constructor() {
// THROWS ERROR "JavaScript runtime error: Object doesn't support this action"
var x = new my.namespace.one();
}
}
}
At runtime, I get the error "Object doesn't support this action" when trying to instantiate a new "one" class. Debugging in anotherClass's constructor, I can see my.namespace.one and my.namespace.two don't exist at this point.
I added this line at the top of anotherClass.ts and it didn't resolve:
/// <reference path="referencedFile.ts" />
My typescript Visual Studio settings "Combine Javascript output into one file: Scripts\oneFile.js"
I can see in the generated "oneFile.js", the code from referencedFile.ts is there, and it is in the file before the code from anotherClass.js so I don't think there is an ordering issue.
What gives?
importkeyword, since you're using a version which supports it. It takes over for the/// <referencecomments and provides an experience more in line with recent versions of ECMAScript. I'm not sure why you're getting this error, but it could have to do with the way the files are compiled.