Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Clerk · Interface

UserResource

UserResource is Clerk’s type for a user object used in application code. Import it through the SDK’s public types entry point to add type safety to user data and operations.

How it works

UserResource is Clerk’s typed representation of one user. Import it from the SDK’s public types entry point, then use it to type values containing user data and account-management capabilities exposed by Clerk.

Syntax

import type { UserResource } from '@clerk/shared/types'

Returns

A type describing a Clerk user resource; it is not a runtime-returning function.

Key points

  • Use UserResource to make user-related TypeScript code safer and easier to refactor.
  • UserResource is part of Clerk’s collection of application-facing types.
  • The JavaScript SDK import is a type-only import from @clerk/shared/types.
  • Framework integrations expose their types through their public /types entry point.

Common mistakes

  • Install @clerk/shared before importing UserResource from the shared types entry point.
  • Use a type-only import so the type does not become a runtime dependency.

Example: Type-check a user resource

import type { UserResource } from '@clerk/shared/types'

export function displayName(user: UserResource): string {
  return user.fullName ?? user.primaryEmailAddress?.emailAddress ?? user.id
}

This type-only import lets TypeScript validate code that reads a Clerk user resource without adding a runtime import.

When to use it

Type user values

Typing functions, component props, or state that receive a Clerk user.

Safely access user data

Reading user properties with editor completion and compile-time checks.

Define reusable contracts

Sharing a stable user type across application modules without runtime imports.

Interview questions

QWhat is UserResource and how do you import it?

UserResource is a Clerk type describing the current user object and its user-management data. In the JavaScript documentation, it is imported from @clerk/shared/types with a type-only import.

Follow-up: Why use a type-only import? It preserves compile-time checking while avoiding a runtime module import for a type.

QWhat setup is required before using UserResource?

First install @clerk/shared, then import UserResource from the package’s /types entry point. The import is written with TypeScript’s type-only syntax.

Follow-up: How would you adapt the import for a framework SDK? Use that SDK’s public /types entry point, such as the React SDK’s /types entry point.

QHow should application code use this interface?

A UserResource value can be used to type code that works with a Clerk user, including user data and account-management operations. It is a type rather than a runtime object constructor.

Follow-up: How can an application obtain a current UserResource? Use the framework’s user-access API, such as a documented useUser hook, whose user value is typed as UserResource.

  • useUser()
  • User
  • @clerk/shared/types

Source: Clerk types - Types - JavaScript | Clerk Docs. Checked 2026-10-15.