firebase / firebase/firebase-js-sdk

TypeScript Error: Property 'reloadUserInfo' does not exist on type 'User'.

Open
#7,672 11 comments 0 reactions 0 assignees View on GitHub
api: auth feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### Operating System

Ubuntu 22.04.3 LTS

### Browser Version

Chrome/117.0.5938.92 (Official Build) (64-bit)

### Firebase SDK Version

10.3.0

### Firebase SDK Product:

Auth

### Describe your project's tooling

Nuxt 3 application with Vite and Vue 3.

### Describe the problem

Property `reloadUserInfo` is not defined in the type definition of [`User`](https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth-types/index.d.ts#L21) but `is accessible via the user object` retrieved from the `getAuth().currentUser` utility in the auth module.

Property Property `reloadUserInfo` should be added to the type definition of [`User`](https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth-types/index.d.ts#L21), to resolve the TypeScript error faced when using that in the source code.

![image](https://github.com/firebase/firebase-js-sdk/assets/79717090/e4fbab27-1dd2-42e2-88dd-59418c58731f)

I want to use one of the properties from this object for my application's authentication use case which is otherwise unavailable directly in the `User` instance. (Have referred https://github.com/firebase/firebase-js-sdk/issues/6364, as well)

### Steps and code to reproduce issue

**Source Code:**
```
async fetchUser(): Promise < User | null > {
try {
const user = (await getAuth()).currentUser;
console.log(user?.reloadUserInfo);
return user;
} catch (error) {
console.log(error);
}
}

fetchUser().then((user) => {
console.log(user);
});

```
**Output:**

When I console logged the output of the `user.reloadUserInfo`, it got an object with the following keys:
![image](https://github.com/firebase/firebase-js-sdk/assets/79717090/33eeb1ac-3a0e-4120-b788-d1bbbb9e0225)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.