-
Notifications
You must be signed in to change notification settings - Fork 3k
Filter operator incorrect type inference #2927
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
Comments
This looks like a TypeScript problem, to me. And not a problem with the RxJS typings. Interestingly, if const a = Observable.from([1, '1'])
.pipe(
filter((x: any): x is string => typeof x === 'string')
);
const b = Observable.from([1, '1'])
.filter((x: any): x is string => typeof x === 'string'); They are also inferred as you'd expect if |
@cartant Thanks for answering, BTW, did you faced with some relevant issue on TS repo? |
I guess, that one: microsoft/TypeScript#18562 |
Closing this as it's a TypeScript issue - see the comment above. |
RxJS version: 5.5.0-beta.5
Code to reproduce:
Expected behavior:
Type of
a
andb
must beObservable<string>
Actual behavior:
Type of
a
andb
inferred asObservable<string | number>
Additional information:
Typescript: 2.5.3
tsconfig.json:
Hi folks,
You created the most awesome reactive library I ever used. But I faced with the issue I cannot explain to myself.
PS: Are there any additional information I can collect to help with this issue?
The text was updated successfully, but these errors were encountered: