Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arguments spread doesn't take into account actual array length #19419

Closed
sebek64 opened this issue Oct 23, 2017 · 4 comments
Closed

Arguments spread doesn't take into account actual array length #19419

sebek64 opened this issue Oct 23, 2017 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@sebek64
Copy link

sebek64 commented Oct 23, 2017

TypeScript Version: 2.6.0-rc, 2.7.0-dev.20171021

Code

function a(first: string, ...args: string[]);
function a(...args: string[]) {
}

const b = ["a", "x"];

if (a.length > 0) {
    a(...b);
}

Expected behavior:
Should not produce error.

Actual behavior:
Produces
error TS2557: Expected at least 1 arguments, but got a minimum of 0.

@Ghabriel
Copy link

I created an issue yesterday that seems to be about the same problem: #19403
No answers yet, though. Nice to know that I'm not the only one who encountered this problem.

@sebek64
Copy link
Author

sebek64 commented Oct 23, 2017

@Ghabriel oops, I checked for duplicities a few days ago and found nothing. Today, I just reported the problem.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 23, 2017

Duplicate of #4130

@mhegazy mhegazy marked this as a duplicate of #4130 Oct 23, 2017
@mhegazy mhegazy added the Duplicate An existing issue was already created label Oct 23, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Nov 7, 2017

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@mhegazy mhegazy closed this as completed Nov 7, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants