-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
I'm not sure if this should work or not? I have a circular dependency between two modules which doesn't appear to be working. This code is written in TypeScript, and I'm using CommonJS as the output format (I can post the produced JS too, if needed):
mod-a.ts:
import { ClassB } from './mod-b';
export class ClassA
{
constructor()
{
}
public isB(): boolean
{
return this instanceof ClassB;
}
}
mod-b.ts:
import { ClassA } from './mod-a';
export class ClassB extends ClassA
{
constructor()
{
super();
}
}
index.ts
import { ClassA } from './mod-a';
import { ClassB } from './mod-b';
var a = new ClassA();
var b = new ClassB();
window.alert(a.isB());
window.alert(b.isB());
The result is an error within the TypeScript-injected __extends function in mod-a.ts where it attempts to set the prototype of the class to that of the base constructor. It's because the base constructor is undefined.
Honestly not sure if this is a problem in TypeScript, in SystemJS, or if it's simply because I'm using the CommonJS output format, and only the register output can handle circular references?