Open
Description
π Search Terms
"JSDoc","@type","union"
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
/** @type {string | undefined} */
var union_with_undefined;
function func(/** @type {string | undefined} */ param) {};
/** @type {string | number} */
var string_number_union;
π Actual behavior
/** @type {string | undefined} */
var union_with_undefined; //This is type string
π Expected behavior
/** @type {string | undefined} */
var union_with_undefined; //This is type string|undefined
Additional information about the issue
/** @type {string | undefined} */
var union_with_undefined; //This is type string
function func(/** @type {string | undefined} */ param) {}; //The function has the correct signature, but inside the function the param is type string
/** @type {string | number} */
var string_number_union; //Unions with anything things that are not null/undefined are correctly typed