Courtesy of @MikeyBurkman, reported in #11597 (comment)
/**
* @typedef {Object} Opts
* @property {string} x
* @property {string=} y
*
* @param {Opts} opts
*/
function foo(opts) {
console.log(opts);
}
foo({x: 'abc'});
That call to foo() will be flagged because it's missing y in the opts. The type checker does not recognize any of the methods of specifying optional parameters listed on the wiki. I even tried doing TS-style using @property {string?} y and still no luck.
Courtesy of @MikeyBurkman, reported in #11597 (comment)
That call to foo() will be flagged because it's missing
yin the opts. The type checker does not recognize any of the methods of specifying optional parameters listed on the wiki. I even tried doing TS-style using@property {string?} yand still no luck.