js
interface Foo { x: number; }
var Foo;
is legal TS. But if you translate the interface into Closure directly it goes into the single (value) namespace and the two definitions conflict.
It's easy enough to just emit interfaces under some mangled name in Closure, e.g.
js
interface Foo { x: number }
/** */
function tsickle_Foo() {}
/** {number}
tsickle_Foo.prototype.x;
but then you need to fix every reference to that interface in any Closure type, while at the same time leaving other references (e.g. Array) alone. And you need to figure out how to import it across files (if a file does import {Foo} from bar, you'd need to change it to import {Foo, tsickle_Foo} from bar).
该提问来源于开源项目:angular/tsickle