Closed
Description
I'm adding type annotations to a JS codebase, and one problematic case I've come across is that I cannot overload function signatures using comment-based annotations.
/** @type {(flag: true) => integer;} */
/** @type {(flag: false) => string;} */
function getResult(asInteger) {
// do stuff here
}
The workaround for now would be splitting the function into two functions, or type-casting at each use of the function. So far my choice will be to split the function.