Skip to content

JSDoc rest is incorrectly handled #19444

@mihailik

Description

@mihailik

TypeScript Version: 2.7.0-dev.20171024

Code

/** @param {...number} a */
function f(a) {
    console.log(arguments[0]);
}
f([1, 2]); // this should fail, but passes [[1]]
f(1, 2); // this should pass, but fails [[2]]

node ./node_modules/typescript/lib/tsc.js multi.js --out multiout.js --allowjs --checkjs

Expected behavior:

Fail at [[1]] pass at [[2]]

Actual behavior:

Passes [[1]], but fails at [[2]]:

multi.js(6,3): error TS2345: Argument of type '1' is not assignable to parameter of type 'number[]'.

Regression introduced at #18825

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions