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

test(dtslint): add race #4344

Merged
merged 2 commits into from
Jan 29, 2019
Merged

Conversation

timdeschryver
Copy link
Contributor

Description:
This PR adds dtslint tests for race.

Related issue (if exists): #4093

@coveralls
Copy link

coveralls commented Nov 15, 2018

Pull Request Test Coverage Report for Build 7741

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 35 unchanged lines in 4 files lost coverage.
  • Overall coverage decreased (-0.001%) to 96.805%

Files with Coverage Reduction New Missed Lines %
src/internal/Subject.ts 2 93.48%
src/internal/Observable.ts 2 91.67%
src/internal/observable/dom/WebSocketSubject.ts 15 84.51%
src/internal/Subscriber.ts 16 81.65%
Totals Coverage Status
Change from base Build 7636: -0.001%
Covered Lines: 5242
Relevant Lines: 5415

💛 - Coveralls

});

it('should allow observables and arrays', () => {
const o = of('a', 'b', 'c').pipe(race(of('x', 'y', 'z'), [of('t', 'i', 'm')])); // $ExpectType Observable<string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wow. I had no idea that the typings for race allowed this. I'm not at all sure how this would work. Or whether it's an error in the typings. I'll do some investigation, later.

Copy link
Member

Choose a reason for hiding this comment

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

Okay... weirdly, because sync, this is always correct... but I still think it's a typings error.

of('test').pipe(race(anything, you, want, here))will always result inObservable<"test">. Because the leading observable, of('test')` will emit synchronously before any of the other sources are subscribed to.

However, I'd expect Observable<string>.pipe(race(Observable<string>, Array<Observable<string>>)) to result in Observable<string|Observable<string>> as a matter of typings.

Copy link
Member

Choose a reason for hiding this comment

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

@timdeschryver can we remove this type check and file an issue? I don't think we want to enforce this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We sure can, but wouldn't it be helpful to have this typing while resolving the issue?(Because you would have an example).

});

it('should allow observables and arrays', () => {
const o = of('a', 'b', 'c').pipe(race(of('x', 'y', 'z'), [of('t', 'i', 'm')])); // $ExpectType Observable<string>
Copy link
Member

Choose a reason for hiding this comment

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

@timdeschryver can we remove this type check and file an issue? I don't think we want to enforce this.

@timdeschryver
Copy link
Contributor Author

Issue #4390 is created.

@benlesh benlesh merged commit 9b4f358 into ReactiveX:master Jan 29, 2019
@benlesh
Copy link
Member

benlesh commented Jan 29, 2019

thanks, @timdeschryver

@timdeschryver timdeschryver deleted the pr/dtslint-race branch January 30, 2019 18:12
@lock lock bot locked as resolved and limited conversation to collaborators Mar 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants