-
Notifications
You must be signed in to change notification settings - Fork 988
Update Observer and Messaging types to match internal types #786
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
Conversation
packages/firebase/index.d.ts
Outdated
| complete(): any; | ||
| error(error: E): any; | ||
| next(value: V | null): any; | ||
| interface Observer<T> { |
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.
this part of the change is breaking and we just shipped our 5.0.0 release.
You'll need to remove this portion (and other relevant edits).
For context: Users can annotate their TS code w/ firebase.Observer<any, any>. This change breaks that experience.
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.
It's not a breaking change, it's a bug fix. If they are annotating with any, then they are using wrong types and their application will not work as expected. In the implementation, ErrorFn takes an Error instance as its argument, not any. If they expect it to be any, they're going to have a bad time.
Changed it to a generic with a default value of Error, so at least users can do firebase.observer<any> (and second generic will default to Error) as well as firebase.Observer<any, any>.
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.
Disagree wholeheartedly that annotating with any is "using wrong types" and I can write a fully functional application using only any types throughout my app.
That said, I'm happy w/ the default Error type in the generic. Existing type annotations won't break and you support the single param generic use case which, altogether, is a better place to land.
Thanks!
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.
Sure you could, but if you tried to call .message on a number or a string, you'd get a runtime error :)
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
90a071a to
8f57b8d
Compare
|
CLAs look good, thanks! |
No description provided.