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

Array spread of tuple type yields error when used to call matching function. #24241

Closed
rzvc opened this issue May 18, 2018 · 3 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@rzvc
Copy link

rzvc commented May 18, 2018

TypeScript Version: 2.9.0-dev.20180516

Search Terms: tuple rest spread function

Code

function f(a: number, b: string) : void
{
}

let params : [number, string] = [10, 'test'];

f(...params);

Expected behavior:
I expect that to compile without any errors.

Actual behavior:
error TS2556: Expected 2 arguments, but got 0 or more.

@s-ve
Copy link

s-ve commented May 18, 2018

duplicate of #4130 ?

@rzvc
Copy link
Author

rzvc commented May 18, 2018

Looks like it, yes.

This issue came up when thinking about #24240, which has applications in forwarding rest parameters.

@ghost ghost added the Duplicate An existing issue was already created label May 18, 2018
@typescript-bot
Copy link
Collaborator

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

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