Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
According to RFC7519:
I thought it might make more sense to include some additional JSON primitives. This would make checking claims like
{ admin: true }
more type safe.In my specific use case, I am using this function from Reactfire:
From: https://github.com/FirebaseExtended/reactfire/blob/a2d2f1c36450515e81e07bd50f539266f5d825dc/docs/reference/modules/auth.md#usesignincheck
Which types the
requiredClaims
option to the types affected by this pull request:From: https://github.com/FirebaseExtended/reactfire/blob/2b564029a1903ef6b3f16c555693c264982ae678/src/auth.tsx#L8-L9
Without these changes, the
useSignInCheck
code block from above would produce the following type error:This could be a seen as a Reactfire issue, but unless I'm mistaken, I don't see the harm in adding these primitives to the custom claims type.