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

Spread operator and Union types #6677

Closed
sebdoucet opened this issue Jan 27, 2016 · 2 comments
Closed

Spread operator and Union types #6677

sebdoucet opened this issue Jan 27, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@sebdoucet
Copy link

Hi,

As it is right now, it's not possible to do that:

class Point{
   constructor(public x: number, public y: number){ }
   add(x: number, y: number): void {
     this.x+= x;
     this.y+= y;
  }
}

// Strict data structure
let pointData: [number, number] = [0,0];

// That does not compile
let point = new Point(...pointData);
// That does not compile too
point.add(...pointData);

Is there a reason why it's not supported ?

Regards,
Sébastien.

@sebdoucet sebdoucet changed the title Spread operator and destructuring Spread operator and Union types Jan 27, 2016
@sandersn
Copy link
Member

Addressed by proposal #5453.

@sandersn
Copy link
Member

And by the associated proposal #5296.

@sandersn sandersn added the Duplicate An existing issue was already created label Jan 27, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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

2 participants