Override Clerk interfaces with custom types
Clerk provides TypeScript interfaces that you can use to define custom types for your application. Custom types provide auto-complete and prevent TypeScript errors. You can define custom types for the following:
ClerkAuthorization
CustomJwtSessionClaims
OrganizationPublicMetadata
OrganizationInvitationPublicMetadata
OrganizationMembershipPublicMetadata
SignUpUnsafeMetadata
UserPublicMetadata
UserPrivateMetadata
UserUnsafeMetadata
Example
To override an interface, you must define a global type, as shown in the following example:
- In your application's root folder, add a
types
directory. - Inside of the
types
directory, add aglobals.d.ts
file. - Create the
CustomJwtSessionClaims
interface and declare it globally. - Add the custom claims to the
CustomJwtSessionClaims
interface.
Feedback
Last updated on