Skip to content

In TypeScript field initializer override properties set by super constructor #1772

@tbuschto

Description

@tbuschto

Problem description

class Foo extends Composite {
  private _bar = 1;
  constructor(properties) {
    super(properties);
  }
  set bar(value) {
    this._bar = value;
  }
  get bar() { return this._bar; }
}

console.log(new Foo({bar: 2}).bar);

This prints "1"

Expected behavior

Should print "2"

Environment

Any tabris version
any TypeScript version
any Platform

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions