mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-11 15:48:14 -05:00
Merge pull request #16696 from Microsoft/fix15663
Ignore jsdoc when inferring rest args in JavaScript
This commit is contained in:
@@ -6398,7 +6398,7 @@ namespace ts {
|
||||
undefined;
|
||||
// JS functions get a free rest parameter if they reference `arguments`
|
||||
let hasRestLikeParameter = hasRestParameter(declaration);
|
||||
if (!hasRestLikeParameter && isInJavaScriptFile(declaration) && !hasJSDocParameterTags(declaration) && containsArgumentsReference(declaration)) {
|
||||
if (!hasRestLikeParameter && isInJavaScriptFile(declaration) && containsArgumentsReference(declaration)) {
|
||||
hasRestLikeParameter = true;
|
||||
const syntheticArgsSymbol = createSymbol(SymbolFlags.Variable, "args");
|
||||
syntheticArgsSymbol.type = anyArrayType;
|
||||
|
||||
@@ -35,13 +35,13 @@ someRest(1, 2, 3);
|
||||
* @param {number} x - a thing
|
||||
*/
|
||||
function jsdocced(x) { arguments; }
|
||||
>jsdocced : (x: number) => void
|
||||
>jsdocced : (x: number, ...args: any[]) => void
|
||||
>x : number
|
||||
>arguments : IArguments
|
||||
|
||||
jsdocced(1);
|
||||
>jsdocced(1) : void
|
||||
>jsdocced : (x: number) => void
|
||||
>jsdocced : (x: number, ...args: any[]) => void
|
||||
>1 : 1
|
||||
|
||||
function dontDoubleRest(x, ...y) { arguments; }
|
||||
|
||||
Reference in New Issue
Block a user