Closed
Description
/** @template T */
class CC {
/** @param {T} t */
constructor(t) {
}
}
/** @param {CC} cc */
function foo(cc) {
}
Expected behavior:
Error, something like "Expected 1 type arguments, got 0".
Actual behavior:
Expected CC type arguments; provide these with an '@extends' tag.
The error message has 3 problems:
- The error message is intended for classes only (
class DD extends CC { ... }
) - The type isn't quoted.
- The expected number of type arguments isn't given.
I think the fix is two-fold:
- For parameters, go back to the normal error message.
- For classes, give the number of expected type arguments instead of the class name, which is already given. Reading the code, I'm almost certain this is a bug in which the code chooses between multiple messages and then passes them all the same arguments.