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

feat(combineLatest): support for observable dictionaries (#5022) #5363

Merged
merged 1 commit into from
Jul 14, 2020
Merged

feat(combineLatest): support for observable dictionaries (#5022) #5363

merged 1 commit into from
Jul 14, 2020

Conversation

rraziel
Copy link
Contributor

@rraziel rraziel commented Mar 23, 2020

Description:
Support for passing a dictionary of observables to combineLatest, removing the need to pass an array then directly using map to turn it back into an object.

I mostly based this on the similar work that was done on forkJoin.

Related issue (if exists):
#5022 and #5362

@rraziel
Copy link
Contributor Author

rraziel commented Mar 23, 2020

I updated the commit after an npm run test:side-effects:update, hopefully that was the right thing to do?

@rraziel
Copy link
Contributor Author

rraziel commented Apr 12, 2020

Anything missing or that I need to fix in this PR?

@joshribakoff
Copy link
Contributor

@rraziel not sure if you saw the merge conflicts?

@rraziel
Copy link
Contributor Author

rraziel commented Jun 17, 2020

Yes, they appeared few weeks after my PR, I was kind of hoping for someone to actually answer my questions before doing a rebase 😅

@rraziel
Copy link
Contributor Author

rraziel commented Jun 26, 2020

@joshribakoff alright, rebased and fixed the side-effect weirdness

@rraziel
Copy link
Contributor Author

rraziel commented Jul 9, 2020

I'll resolve the conflicts when someone decides there is any point in having this PR, since there hasn't been any comment since the initial PR over 3 months ago.

@ladyleet
Copy link
Member

ladyleet commented Jul 9, 2020

@benlesh @cartant @niklas-wortmann any thoughts on this?

@benlesh benlesh added the AGENDA ITEM Flagged for discussion at core team meetings label Jul 9, 2020
@benlesh benlesh requested a review from cartant July 9, 2020 22:02
@rraziel
Copy link
Contributor Author

rraziel commented Jul 10, 2020

Rebased + api_guard files updated.

@cartant
Copy link
Collaborator

cartant commented Jul 10, 2020

Rebased + api_guard files updated.

Thanks. I'll review this later today.

BTW, ignore the CircleCI failure. It's not effected by this PR.

Copy link
Collaborator

@cartant cartant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a minor nit with the dtslint test.

});

it('should work for the simple case', () => {
const res = combineLatest({ foo: of(1), bar: of('two'), baz: of(false) }); // $ExpectType Observable<{ foo: number; bar: string; baz: boolean; }>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this test to use the helpers - a$, etc. - instead of of with literal values.

I can see that what's here is based on the forkJoin tests - which use of and literal values - but that's because those tests have not been refactored to use the helpers. Going forward, we should favour using the helpers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the helpers are - so far - only used in spec-dtslint/operators/*.spec.ts and not in spec/observables/*.spec.ts.
Can I just import those same helpers in spec/? (as they are in spec-dtslint/helpers)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. They're only for use - at least ATM - in the dtslint tests. They offer a somewhat more disciplined approach regarding the types - there are only a few different literal types, but we can add as many distinct 'helper' types as is necessary. With the tests in spec, we're less interested in the types and more interested in the notifications and their values and strings, etc. would be fine there.

@benlesh benlesh removed the AGENDA ITEM Flagged for discussion at core team meetings label Jul 14, 2020
@benlesh benlesh merged commit f5278aa into ReactiveX:master Jul 14, 2020
@benlesh
Copy link
Member

benlesh commented Jul 14, 2020

Thank you, @rraziel! Very nice!

@rraziel rraziel deleted the combineLatest-dictionary-support branch July 15, 2020 07:39
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

Successfully merging this pull request may close these issues.

5 participants