angular / tsickle

Tsickle — TypeScript to Closure Translator
MIT License
896 stars 110 forks source link

Fix JSC_EXPORT_REPEATED_ERROR for separately exported class+namespace #1469

Closed copybara-service[bot] closed 1 year ago

copybara-service[bot] commented 1 year ago

Fix JSC_EXPORT_REPEATED_ERROR for separately exported class+namespace

For separately exported class+namespace tsickle incorrectly generated 2 exports assignments:

class Foo {}
namespace Foo { ... }
export {Foo};

This turned into

class Foo {}
exports.Foo = Foo;
(function(Foo) { ... })(Foo || Foo = {});
exports.Foo = Foo;

This change avoids emitting the 2nd exports assignment. As noted in the comment, we can drop this fix after the TypeScript 5.1 release, which changes how exports assignments are emitted.