Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should putting @observable on a getter produce an error? #1454

Closed
1 task done
JoshuaKGoldberg opened this issue Mar 23, 2018 · 2 comments
Closed
1 task done

Should putting @observable on a getter produce an error? #1454

JoshuaKGoldberg opened this issue Mar 23, 2018 · 2 comments

Comments

@JoshuaKGoldberg
Copy link
Contributor

I have a:

  1. Question: Feel free to just state your question. For a quick answer, there are usually people online at our Gitter channel.

I did a silly:

class MyStore {
    @observable
    public value: number;

    @observable // should have been @computed
    public get double() { return this.value * 2; }
}

Should this produce an error? In practice, MyStore.prototype.timeSinceLastUpdated is undefined, as is all its instances.

@mweststrate
Copy link
Member

It is not a supported case indeed, so a PR for runtime checks is welcome

@quanganhtran
Copy link
Member

Released in 4.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants