UNPKG

@clerk/clerk-react

Version:

Clerk.dev React library

32 lines (28 loc) 644 B
import { noClerkProviderError, noGuaranteedLoadedError, noGuaranteedUserError, } from '../errors'; export function assertWrappedByClerkProvider( contextVal: unknown, ): asserts contextVal { if (!contextVal) { throw new Error(noClerkProviderError); } } export function assertClerkLoadedGuarantee( guarantee: unknown, hookName: string, ): asserts guarantee { if (!guarantee) { throw new Error(noGuaranteedLoadedError(hookName)); } } export function assertUserGuarantee( guarantee: unknown, hookName: string, ): asserts guarantee { if (!guarantee) { throw new Error(noGuaranteedUserError(hookName)); } }