clutz icon indicating copy to clipboard operation
clutz copied to clipboard

Aliased types are not fully qualified, thus producing wrong TS

Open rkirov opened this issue 8 years ago • 1 comments

Consider:

/** @typedef */
var Foo;

/** @const */
var ns;

/** @typedef {Foo | string} */
ns.Foo;

To closure, Foo in the second type def is the global one. Clutz outputs:

namespace clutz.foo {
  type Foo = Foo | string;
}

Which is an error. If clutz output instead:

namespace clutz.foo {
  type Foo = clutz.Foo | string;
}

we would be back in business.

rkirov avatar May 20 '16 21:05 rkirov

This is still an issue, but a better repro is:

goog.provide('ns');

/** @constructor */
function Foo() {};

/** @typedef {Foo | string} */
ns.Foo;

It's pretty low on my importance/work required chart.

rkirov avatar Nov 20 '18 15:11 rkirov