-
Notifications
You must be signed in to change notification settings - Fork 3k
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
test(dtslint): add race #4344
Conversation
Pull Request Test Coverage Report for Build 7741
💛 - Coveralls |
spec-dtslint/operators/race-spec.ts
Outdated
}); | ||
|
||
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> |
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.
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.
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.
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 in
Observable<"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.
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.
@timdeschryver can we remove this type check and file an issue? I don't think we want to enforce this.
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.
We sure can, but wouldn't it be helpful to have this typing while resolving the issue?(Because you would have an example).
spec-dtslint/operators/race-spec.ts
Outdated
}); | ||
|
||
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> |
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.
@timdeschryver can we remove this type check and file an issue? I don't think we want to enforce this.
Issue #4390 is created. |
thanks, @timdeschryver |
Description:
This PR adds dtslint tests for
race
.Related issue (if exists): #4093