Skip to content

fix: private property not encoding #1812

Open
@pjebs

Description

@pjebs
class Rectangle {

  #color

  constructor(height, width, color) {
    this.height = height;
    this.width = width;
    this.#color = color;
  }

  area() {
    return this.height * this.width;
  }

  color2() {
    return this.#color;
  }
}


let r = new Rectangle(45,477, 'blue');

let ir = instanceToPlain(r);
console.log(ir)

let users = plainToInstance(Rectangle, ir); 
console.log(users.color2()); <----------------------- undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions