Skip to content

Inconvenient type of UserRecord.customClaims #864

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

Closed
anantakrishna opened this issue Apr 23, 2020 · 0 comments · Fixed by #866 or andy0937/firebase-admin-node#1
Closed

Inconvenient type of UserRecord.customClaims #864

anantakrishna opened this issue Apr 23, 2020 · 0 comments · Fixed by #866 or andy0937/firebase-admin-node#1
Assignees

Comments

@anantakrishna
Copy link

anantakrishna commented Apr 23, 2020

Environment

  • Operating System version: Windows
  • Firebase SDK version: 8.11.0
  • Firebase Product: auth
  • Node.js version: 10.20.1
  • NPM version: 6.14.4

The problem

Typing of UserRecord.customClaims is Object.
This is inconvenient to use typescript optional chaining in this case.

const user = await admin.auth().getUser(uid);
if (user.customClaims?.roles?.coordinator)
  …

Produces the following error:

Property 'roles' does not exist on type 'Object'.ts(2339)

This contrasts to the DecodedIdToken which has [key: string]: any; indexer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants