I have a JavaScript class that takes one argument of type Object with defined set of properties and the Closure Compiler is happy when I annotate it like:
@constructor
@param {{ subview:BaseView, el:(jQuery|Element), title:String }} options
var MyView = function(options){ }
I would like to make title
key optional and pass title
value to some instances of my class and implement fallback behavior when this key is not present, so I annotated my class with:
@constructor
@param {{ subview:BaseView, el:(jQuery|Element), title:String= }} options
var MyView = function(options){ }
and now Closure Compiler is complaining:
WARNING - Bad type annotation. expected closing }
I've checked Annotating JavaScript for the Closure Compiler, but I see no single line describing such use case.
@param {{ subview:BaseView, el:(jQuery|Element), title:(string|undefined) }} options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With