UNPKG

@clerk/clerk-react

Version:

Clerk.dev React library

28 lines 1.22 kB
import { ActiveSessionResource, SessionResource } from '@clerk/types'; import React from 'react'; declare type SessionTypes = ActiveSessionResource | null | undefined; declare type SessionContextValue = { value: SessionTypes; }; export declare const SessionContext: React.Context<SessionContextValue | undefined>; export declare function useSessionContext(): SessionContextValue; declare type UseSessionWithAssertionsResponse = { session: SessionTypes; isLoading: (session: SessionTypes) => session is undefined; isSignedOut: (session: SessionTypes) => session is null; isSignedIn: (session: SessionTypes) => session is ActiveSessionResource; }; export declare function useSession(options?: { withAssertions: false; }): ActiveSessionResource; export declare function useSession(options: { withAssertions: true; }): UseSessionWithAssertionsResponse; export declare const withSession: <P extends { session: SessionResource; }>(Component: React.ComponentType<P>, displayName?: string | undefined) => React.FC<Omit<P, "session">>; export declare const WithSession: React.FC<{ children: (session: SessionResource) => React.ReactNode; }>; export {}; //# sourceMappingURL=SessionContext.d.ts.map