firebase / firebase/firebase-js-sdk
firebase.auth.currentUser.linkWith functions have confusing return type.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: N/A
* Browser version: N/A
* Firebase SDK version: 6.4.2
* Firebase Product: auth
### [REQUIRED] Describe the problem
Successful calls to the class of functions with the signature `firebase.auth.currentUser.linkWith*` if successful return an object of the type `firebase.auth.UserCredential`. Which has a `user` property of type `firebase.User | null`. It should not be the case if this call is correct that the `user` property is null. This leads to unnecessary developer confusion as well as fighting with the TypeScript type engine.
**Suggested change is a non-nullable version of `firebase.auth.UserCredential` something of the effect:**
`type NonNullUserCredential = firebase.auth.UserCredential & {user: firebase.User}
`
#### Steps to reproduce:
N/A
#### Relevant Code:
N/A
https://stackblitz.com/fork/firebase-issue-sandbox
```javascript
// TODO(you): code here to reproduce the problem
```
Contributor guide
Assessment
This issue has not been assessed yet.