Skip to content

Commit c54ada0

Browse files
authored
Merge pull request #658 from clerkinc/COR-58
fix(clerk-react): Export HOC-related types to support older React patterns
2 parents ecbba5d + 3c4ba11 commit c54ada0

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

packages/react/src/index.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
export * from './contexts';
22
export * from './components';
33
export * from './hooks';
4-
export type { BrowserClerk, ClerkProp, HeadlessBrowserClerk } from './types';
4+
export type {
5+
BrowserClerk,
6+
ClerkProp,
7+
HeadlessBrowserClerk,
8+
WithUserProp,
9+
WithClerkProp,
10+
WithSessionProp,
11+
} from './types';
512
export { isMagicLinkError, MagicLinkErrorCode } from './errors';
613
export { useMagicLink } from './hooks/useMagicLink';
714

packages/react/src/types.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import type { Clerk, ClerkOptions, ClientResource, LoadedClerk, RedirectOptions, UserResource } from '@clerk/types';
1+
import type {
2+
Clerk,
3+
ClerkOptions,
4+
ClientResource,
5+
LoadedClerk,
6+
RedirectOptions,
7+
SessionResource,
8+
UserResource,
9+
} from '@clerk/types';
210

311
declare global {
412
interface Window {
@@ -30,9 +38,11 @@ export interface HeadlessBrowserClerkConstrutor {
3038
new (frontendApi: string): HeadlessBrowserClerk;
3139
}
3240

33-
export type WithClerkProp<T> = T & { clerk: LoadedClerk };
41+
export type WithClerkProp<T = unknown> = T & { clerk: LoadedClerk };
3442

35-
export type WithUserProp<T> = T & { user: UserResource };
43+
export type WithUserProp<T = unknown> = T & { user: UserResource };
44+
45+
export type WithSessionProp<T = unknown> = T & { session: SessionResource };
3646

3747
// Clerk object
3848
export interface MountProps {

0 commit comments

Comments
 (0)