clutz
clutz copied to clipboard
Aliased types are not fully qualified, thus producing wrong TS
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.
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.