Reputation: 477
When I run this function I get back an error that says TS7030: Not all code paths return a value.
async function checkAuthClaims(userId: string) {
return admin
.auth()
.getUser(userId)
.then((userRecord) => {
console.log("User's custom claims: ", userRecord.customClaims);
return {
role: userRecord?.customClaims?.["role"],
type: userRecord?.customClaims?.["type"],
};
});
}
If you know how to get rid of this error please let me know. Any help is appreciated :)
Upvotes: 0
Views: 52
Reputation: 515
Use the first form of the function (the one with onRejected in it) to see if getUser(userId)
fails (in other words, the Promise doesn't resolve correctly).
Upvotes: 1