angular/clutz

enum aliases are incorrectly emitted in partial mode

Closed this issue · 4 comments

The current emit is broken, but we haven't noticed because we don't do syntactic correctness checks for 'partial' mode clutz.

See https://github.com/angular/clutz/blob/master/src/test/java/com/google/javascript/clutz/testdata/partial/enum_alias.d.ts

I am turning off this test for now, so that closure can land a change in emit, on our side it changes from one incorrect emit to another, so no point blocking that change. Once it lands we should revisit proper emit here.

I just ran into an example of this in real-world code:

goog.module('a.b.c');

const Mod = goog.require('some.ts.module');

const {E} = Mod;
/**
 * @enum {string}
 */
const EA = E;

exports = EA;

In order to emit correct alias to some.ts.module module we need to know whether it's goog.provide or goog.module. Because it will be either some.ts.module or module$exports$some$ts$module. Do we have that info in partial mode somehow?

Internal issue created: b/144351396.