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

Destructured parameter properties do not introduce properties into their respective class #1541

Closed
DanielRosenwasser opened this issue Dec 20, 2014 · 6 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

class C {
    constructor(public [x, y, z]: string[]) {
    }
}

var c = new C([]);
c.x === c.y;

which gives us

error TS2339: Property 'x' does not exist on type 'C'
error TS2339: Property 'y' does not exist on type 'C'

The question is should we be adding properties when destructuring in the face of a visibility modifier?

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Question An issue which isn't directly actionable in code labels Dec 20, 2014
@RyanCavanaugh RyanCavanaugh added Spec Issues related to the TypeScript language specification and removed Question An issue which isn't directly actionable in code labels Jan 8, 2015
@sophiajt sophiajt added this to the TypeScript 1.5 milestone Jan 12, 2015
@DanielRosenwasser
Copy link
Member Author

@jonathandturner and I spoke offline and decided that the binding parameters should introduce properties of the appropriate visibility.

@DanielRosenwasser
Copy link
Member Author

@ahejlsberg and I spoke offline and decided that binding parameters should not introduce properties of the appropriate visibility.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 15, 2015

Reopening to update the spec.

@mhegazy mhegazy reopened this Jan 15, 2015
@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Jan 15, 2015
@DanielRosenwasser
Copy link
Member Author

This is Fixed as far as the work goes; the spec work needs to be done.

@danquirk
Copy link
Member

Let's create new bugs for spec work, that way you can close this with the fixed label. Otherwise we should remove the fixed label from this one, which then makes confusing the fact that it does represent dev work that fixed an issue.

@DanielRosenwasser
Copy link
Member Author

Agreed; I've opened up #1691 instead.

@DanielRosenwasser DanielRosenwasser removed the Spec Issues related to the TypeScript language specification label Jan 16, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

6 participants