Let's say I have a declarations file foo.d.ts:
declare namespace foo {
interface Bar {
(): void;
}
}
declare var foo: foo.Bar;
export default foo;
If I compile this:
import Foo from './foo';
Foo();
The resulting output is:
"use strict";
var foo_1 = require('./foo');
foo_1["default"]();
However this code won't run as foo_1 is a function and has no property default. How can I get the output to be foo_1() instead of foo_1["default"]()?
declare namespace foo {}and adeclare var fooin the same file. try renaming one of those.