HoriSun / closure-compiler

Automatically exported from code.google.com/p/closure-compiler
0 stars 0 forks source link

built-in "keyOf" annotation/support for using keys as strings #1297

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
React has a strategy for accessing renamed keys as strings:
https://github.com/facebook/react/blob/master/src/vendor/core/keyOf.js

It might be of value to have an annotation for "@keyOf", similar in spirit to 
the way idGenerator works.

Original issue reported on code.google.com by jhiswin on 8 Apr 2014 at 8:29

GoogleCodeExporter commented 9 years ago
i believe this works out of the box, without additional annotations.

Original comment by Nicholas.J.Santos on 9 Apr 2014 at 4:27

GoogleCodeExporter commented 9 years ago
Oh. I didn't mean this as a bug, but a possible feature request.

Instead of depending on keyOf behavior, have the compiler go ahead and replace 
keyOf calls with the minified strings in a similar fashion to the @idGenerator 
annotation.

Original comment by jhiswin on 11 Apr 2014 at 4:17