Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Using rest parameters in JavaScript type annotations seems broken in 3.1 #28637

Copy link
Copy link
@the-ress

Description

@the-ress
Issue body actions

TypeScript Version: 3.3.0-dev.20181121

Search Terms: js, javascript, A rest parameter must be of an array type

Code

//@ts-check
/** @type {(...bar: string[]) => void} */
function foo(...bar) {}

Expected behavior:
Doesn't report any errors. Type of bar parameter is string[].

Actual behavior:

asdf.js:3:14 - error TS2370: A rest parameter must be of an array type.

3 function foo(...bar) {}
               ~~~~~~

Found 1 error.

VS Code intellisense shows bar is string instead of string[].

TypeScript 3.0.3 works as expected, 3.1.1 and later versions don't.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptA bug in TypeScriptDomain: JavaScriptThe issue relates to JavaScript specificallyThe issue relates to JavaScript specifically

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.