Export * for interfaces generates redundant JS
I have a fileinterfaces.d.ts which defines some interfaces, e.g:
export interface IFoo {}
export interface IBar {}
I want to reexport all interfaces in another module:
export * from "interfaces";
When targeting AMD, compiled code looks like this:
define(["require", "exports", "interfaces"], function (require, exports, interfaces_1) {
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(interfaces_1);
});
Module "interfaces" should not be imported at all, because it doesn't contain any JS code. To fix this I have to list all exported interfaces manually:
export { IFoo, IBar } from "interfaces";
It's a problem if the number of interfaces is large.
I use version 1.5.3.
Just curious as to why it's a problem if the number of interfaces are large, given that interfaces have no runtime representation?
@matthewjh It's not a problem of performance at runtime. It's a problem of development. We convert old JS code to TS and actively add new types and interfaces. So the number of interfaces changes frequently and it's not very good idea to support them in two places.