Playground Link
// @ts-check
/**
* @overload
* @param {number} x
*/
/**
* @overload
* @param {string} x
*/
/**
* @param {string | number} x
* @returns {string | number}
*/
function id(x) {
return x;
}
export let a = id(123);
export let b = id("hello");
Here, the first two signatures of id are missing an @return/@returns tag. That means that they're implicitly any.
Under noImplicitAny, this example should issue an error on both @overload tags saying that they implicitly return the type any.
Playground Link
Here, the first two signatures of
idare missing an@return/@returnstag. That means that they're implicitlyany.Under
noImplicitAny, this example should issue an error on both@overloadtags saying that they implicitly return the typeany.