prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 559 forks source link

`login` return type is broken/messy #996

Open pcorpet opened 3 years ago

pcorpet commented 3 years ago

I think this is a bug, especially when using TypeScript, otherwise it's mostly an inconsistent state.

What is the current behavior?

When firebase.login returns a Promise which resolves in an object that has various types:

The second behavior is not reflected properly in the TypeScript definitions, and requires additional code on our side to handle it.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

I'll try to add repro steps soon, for now it's too entangled in our code.

What is the expected behavior?

I would expect any call to login to return the same kind of objects (for instance being to rely on finding a User in result.user and not in result.user.user sometimes). I would at least expect the result to be consistent with the declaration in index.d.ts

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?

Sorry, I have no clue, this is the first time I'm using this package. Although I think it affects all browser, I'm on linux using Chrome v84. and v3.7.0 of this library.