javascript - How to annotate anonymous object with optional property in JSDoc -
i have javascript class takes 1 argument of type object defined set of properties , closure compiler happy when annotate like:
@constructor @param {{ subview:baseview, el:(jquery|element), title:string }} options var myview = function(options){ }
i make title
key optional , pass title
value instances of class , implement fallback behavior when key not present, annotated class with:
@constructor @param {{ subview:baseview, el:(jquery|element), title:string= }} options var myview = function(options){ }
and closure compiler complaining:
warning - bad type annotation. expected closing }
i've checked annotating javascript closure compiler, see no single line describing such use case.
@param {{ subview:baseview, el:(jquery|element), title:(string|undefined) }} options
Comments
Post a Comment