clutz
clutz copied to clipboard
Translate Closures ! to NonNullable<T> in clutz
In incremental mode we have to translate typedefs without seeing the original definitions.
For example:
/**
* @typedef {string|null}
*/
var StringOrNull;
is translated to:
type StringOrNull = string | null;
However, in closure land when one writes @type {!StringOrNull}
the correct translation is not : StringOrNull
but rather NonNullable<StringOrNull>
.
Thankfully, classes and interfaces are non-nullable by default in TS, so for them this is not an issue.