4b96edf72f
* Treat `...` in jsdoc type as creating a synthetic rest parameter -- not as an array type * Change type parsing so `...T[]` parses as `...(T[])` and not `(...T)[]` * Replace the last parameter with ...args, and make access to it potentially undefined * Code review
15 lines
344 B
TypeScript
15 lines
344 B
TypeScript
// @allowJs: true
|
|
// @checkJs: true
|
|
// @strict: true
|
|
// @noEmit: true
|
|
|
|
// @Filename: /a.js
|
|
/** @param {...number} a */
|
|
function f(a) {
|
|
a; // number | undefined
|
|
// Ideally this would be a number. But currently checker.ts has only one `argumentsSymbol`, so it's `any`.
|
|
arguments[0];
|
|
}
|
|
f([1, 2]); // Error
|
|
f(1, "2"); // Error
|
|
f(1, 2);
|