If I call a template from JavaScript with:
namespace.template(record);
where record
is an instance of:
/** @typedef {{var: string}} */
and I use the Google Closure Compiler in advanced mode, which rewrites var
, then how can I receive var
in the template? Is using 'var'
instead of var
to prevent rewriting the only way to do this?
I'm thinking that, ideally, it would be nice if I could provide types for the template's @param
s, just like I can for the JavaScript code, which should let the compiler know what rewritten name to use...
It looks like this doesn't happen for any value of var
. It does happen though if the key is named default
, because SoyToJsSrcCompiler generates code using 'default'
(for this special name only, not for any other name I used so far), thus preventing Closure Compiler from renaming it, but the property is renamed in the JavaScript code, because I'm using default
without quotes.