eclipsesource / eclipsesource/tabris-decorators

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

Open
#82 0 comments 0 reactions 0 assignees View on GitHub
bug EventHandling
Dominant language
TypeScript
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Since `tabris-decorators@3.7.0`, using listeners named `onChanged` requires `` 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:

```ts
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"
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.