Skip to content

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

@DanielRosenwasser

Description

@DanielRosenwasser
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?

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions