I'm the author of
, a gulp plugin which compiles TypeScript with the TypeScript api. I had a problem with the following code:
Imagine a file
which has an export assignment, that exports a class.
exports that class:
export import MyClass = require('./class');
and creates a new instance of it:
import exportimport = require('./exportimport');
var test = new exportimport.MyClass();
Now the strange part:
The Compiler generates no error if the files are added to the Compiler in this order: class.ts, exportimport.ts, main.ts.
But if the files are added in this order: main.ts, exportimport.ts, class.ts, you get the error
error TS2083: Invalid 'new' expression.
Is this by design? Should the files by added to the compiler in the order they reference each other? Or is this a bug?
As far as I know, other things (like
export class ...
) don't fail if you use another order.