Closed
Description
I'm attempting to create a set of external TypeScript modules as follows:
// ClassA.ts
export default class ClassA {
public method() { return true; }
}
// ModuleB.ts
import ClassA from './ClassA';
var moduleB = {
ClassA: ClassA
};
export default moduleB;
// ModuleA.ts
import moduleB from './ModuleB';
var moduleA = {
moduleB: moduleB
}
export default moduleA;
The idea is that this will be compiled down and supplied as a library. The plan is that the consumer of the library will instantiate an instance of ClassA as follows:
import moduleA from './ModuleA';
var anInstance = moduleA.moduleB.ClassA();
This looks as though it is compiling down to the expected JS, but I'm getting an error compiler error which I'm struggling to find further information about.
Using tsc v1.6.2
.../src/ModuleA.ts(3,5): error TS4023: Exported variable 'moduleA' has or is using name 'ClassA' from external module ".../src/ClassA" but cannot be named.
Can anyone here shed any light on this issue? Does what I'm trying to do make sense?