-
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
WebSocketSubjectConfig's resultSelector is excepting an not necessary generic type T #2754
Comments
Yes, it seems legit and this seems oversight when we didn't have strict generic checks. |
I am still facing issues with this. Here is the code for the WebSocketSubjectConfig.
here is the error:
Notice anything I should be doing different? |
Closing this, as resultSelector has been deprecated for some time. |
Only now I figured out that there are serializer / deserializer arguments in the config of the subject ( https://rxjs.dev/api/webSocket/WebSocketSubjectConfig) |
RxJS version:
5.4.2
Code to reproduce:
Say if you want to make WebSocket subject emits raw MessageEvent, and you write
Expected behavior:
It should compiles
Actual behavior:
Additional information:
I just upgraded to typescript 2.4.1, maybe it has something to do with this change
I can work around the issue either by returning
any
type from theresultSelector
function, or make it a generic function like thisBut returning any is losing the type check, as we know exactly what type to be expected as it's given as an
Rx.Observable.webSocket
type argument. And for the second working around, which is even more awkward .So, maybe a more ideal solution is to make
WebSocketSubjectConfig
also a generic type, and use the T as the return value from resultSelector?The text was updated successfully, but these errors were encountered: