I am using VSCode as my editor, have enabled its type checking feature, and added a JSDoc block tag defining type of parameters the function should take (see code below). How can have VSCode's type checking feature report when this function is passed a parameter other than an object? If I set the type as object in the block tag, then call the function while passing a number value, there is no violation flagged in VSCode (see screenshot here). Why is that--shouldn't this be flagged as a type violation?
The JSDoc page on @param indicates, "The parameter type can be a built-in JavaScript type, such as string or Object."
If I define the input parameter to be of type string instead of object, then call the function while passing a parameter of type number, there is a violation flagged, as expected (screenshot).
Thanks.
My Function + JSDoc Block Tag
/**
* Test description
*
* @param {string} myVar - Description of myVar.
*/
const myFunc = myVar => {
return myVar
}