annotating javascript { ... }?

20 views
Skip to first unread message

Erik Blankinship

unread,
Jan 5, 2013, 3:58:26 PM1/5/13
to closure-comp...@googlegroups.com
Could someone point me at the documentation for annotating the innards of generic JS objects (e.g. 

var myObj = {myKey:[1,2,3], myKey2:{innerKey1:'hi', innerKey2:'ho'}} 

)?

For example, how would I define that object as a parameter?

I apologize for asking what seems like a basic question, but I am still getting my bearings here.  I've reviewed https://developers.google.com/closure/compiler/docs/js-for-compiler but not seeing how to cinch this.  Thank you.

Ilia Mirkin

unread,
Jan 5, 2013, 4:04:14 PM1/5/13
to closure-comp...@googlegroups.com
On the page you linked to, look at "record type". For example here you'd want

{{myKey: Array.<number>, myKey2: {innerKey1: string, innerKey2: string}}}

Note that this does not cause the compiler to all of a sudden stop
from renaming properties in advanced mode.

-ilia
Reply all
Reply to author
Forward
0 new messages