Skip to content

Matching property must exist when on...Changed listeners are used #82

@cpetrov

Description

@cpetrov

Since tabris-decorators@3.7.0, using listeners named on<property name>Changed requires <property name> to be a property declared in the class. The naming pattern on...Changed could be used for e.g. business logic unrelated to changes of class properties, thus the current behavior is overly restrictive. Moreover, this is an unexpected breaking change in tabris-decorators@3.7.0 over the previous version tabris-decorators@3.6.1, as usage of listeners named on...Changed without a matching property was tolerated in tabris-decorators@3.6.1. This breaking change introduces hard to find bugs for users who updated to tabris-decorators@~3.7.0 and use listeners named on...Changed without a matching property.

Example:

import { event } from 'tabris-decorators';

class Foo {
  @event onBarChanged;
}

new Foo().onBarChanged(() => console.log('bar changed'));
>  Could not load main module: Error: Target has no property "bar"

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