Skip to content

Property without declaration: es6 alignment in class constructor #6565

Closed
@Alphapage

Description

@Alphapage

Hello,
When I try this code from #4955:

class Alpha {
  constructor() {
    this.size = 42; //error : but it should be public of type number because no declaration
  }
}
var x = new Alpha();
var y = x.size; // y: number //error

I get the error: property 'size' does not exist on type 'Alpha'.
And when using js with tsserver (vscode), then size is of type any. But in the post, it seems to be supported.
Do you have the same problem in vscode for js ? Is this feature not implemented yet ?

Thanks in advance for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions