-
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
fix: forkJoin/combineLatest return Observable<unknown> if passed any #6227
fix: forkJoin/combineLatest return Observable<unknown> if passed any #6227
Conversation
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
If the user passed that exact shape of object in AnyCatcher, technically it should work. This ensures there's no way it would work properly so `Observable<unknown>` is accurate. Also adds some documentation to the areas
* an array or an object, so you're getting `unknown`. Use better types. | ||
* @param arg Something typed as `any` | ||
*/ | ||
export function combineLatest<T extends AnyCatcher>(arg: T): Observable<unknown>; |
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.
suggestion: I would make this the first signature. IDK why any
skips all of the signatures above this one and I would not like to rely upon that behaviour never changing. There should be no reason this signature cannot be the first.
Actually, I do know why, but I still think the weirdo, any
-catcher signatures should be first - just in case someone adds an additional signature before it and effects different behaviour. The tests would break of, course, but it might not be immediately obvious why. I think the any
-catcher sigs should go first and should be accompanied by a comment that explains why. Or at least says they should remain as the first-placed overload signatures.
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.
That's a really good idea!
src/internal/observable/forkJoin.ts
Outdated
* an array or an object, so you're getting `unknown`. Use better types. | ||
* @param arg Something typed as `any` | ||
*/ | ||
export function forkJoin<T extends AnyCatcher>(arg: T): Observable<unknown>; |
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.
suggestion: Make this the first overload signature.
Resolves #6226