Reputation: 1046
Let's say I have those three files:
moduleA.ts:
export const foo = 42;
moduleB.ts:
module TestModules {
export const bar = 43;
}
moduleC.ts:
import './moduleA';
module TestModules {
console.log(TestModules.bar);
}
When I try to compile, I get a moduleC.ts(4,29): error TS2339: Property 'bar' does not exist on type 'typeof TestModules'.
error.
Why?
I know mixing namespaces and modules ain't great but what if I have an old-style TypeScript project of a considerable size and I want to start using ES6-style modules?
Upvotes: 0
Views: 209
Reputation: 1046
OK, it's explained in this issue: https://github.com/Microsoft/TypeScript/issues/909 .
TL;DR: Don't mix internal and external modules. It doesn't work.
Which sucks bad for older projects: they're pretty much stuck with internal modules or else - good luck refactoring.
Upvotes: 1