Description
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.