-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add a test for emit of a computed property based on an aliased symbol #47978
Conversation
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think test coverage is indeed great idea and it looks clean!
What's the part you think we may not have a test of already? |
I've looked for one 😅 specifically for a case where a variable with such type would be used as a computed property. All tests seem to only use |
That would be because they're all generic |
@weswigham I've taken another round throughout the test suite and I can't find a test like this. Knowing the implementation details perhaps this is just the same as: export class MyObservable<T> {
constructor(private _val: T) {}
subscribe(next: (val: T) => void) {
next(this._val)
}
[Symbol.obs]() {
return this
}
} Here, we also have a computed property. However, this has already worked before #42543 and the test case added in this PR wouldn't work the same before that PR. The closest test that resembles the situation depicted here is this one:
but this file was last touched in 2018 which predates #42543. So since that PR fixed the problem from this added test here, my intuition says that this similar~ test is actually testing something else. The thing that makes this test here somewhat special is not the computed property itself. It's that this symbol type is first assigned to a variable and the computed property is declared using it. |
This doesn't fix anything - it's just a test for something that I think is not explicitly tested anywhere.
I've noticed that this has started to work in 4.3.0:
So I've dug a little bit deeper and I've found out that this has started to work in
4.3.0-dev.20210223
and based on dates of that and the previous nightly release I've concluded that this has changed somewhere here. Looking through those commits I think that most likely this has been enabled by #42543This PR didn't introduce any PR resembling this usage nor I've found any in the current codebase so I've just figured out that it would be great to have a test covering for this since I intend to rely on this behavior 😅
cc @weswigham