Open
Description
/**
* @param {(T|undefined)} a
* @return {T}
* @throws {Error} when property is undefined.
* @template T
*/
function Required(a) {
if (a !== undefined) {
return a;
}
throw new Error('required property is undefined.');
};
/**
* @param {(number)} a
*/
function Test(a) {
}
var a = /** @type {number|undefined} */(11);
Test(Required(a))
This use too work, few month ago.
Now it produces warning:
input0:22: WARNING - actual parameter 1 of Test does not match formal parameter
found : (number|undefined)
required: number
Test(Required(a))
^^^^^^^^^^^
0 error(s), 1 warning(s), 86.6% typed