Skip to content

login return type is broken/messy #996

Open
@pcorpet

Description

@pcorpet

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:

  • if the sign in was done using Google login for instance it returns a UserCredentials object
  • if the sign in was done by email + password it returns an object containing a user property which is a UserCredentials

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtypesChanges associated with typescript types

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions