Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/large-phones-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/react-router': patch
---

Previously, when the `data()` utility was used inside the callback of `rootAuthLoader()` type errors were thrown. These issues should be fixed now.
10 changes: 8 additions & 2 deletions packages/react-router/src/ssr/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
SignUpFallbackRedirectUrl,
SignUpForceRedirectUrl,
} from '@clerk/types';
import type { LoaderFunction } from 'react-router';
import type { LoaderFunction, UNSAFE_DataWithResponseInit } from 'react-router';
import type { CreateServerLoaderArgs } from 'react-router/route-module';

type Func = (...args: any[]) => unknown;
Expand Down Expand Up @@ -97,7 +97,13 @@ type ObjectLike = Record<string, unknown> | null;
*
* In the case of `null`, we will return an object containing only the authentication state.
*/
export type RootAuthLoaderCallbackReturn = Promise<Response> | Response | Promise<ObjectLike> | ObjectLike;
type RootAuthLoaderCallbackReturn =
| Promise<Response>
| Response
| Promise<ObjectLike>
| ObjectLike
| UNSAFE_DataWithResponseInit<unknown>
| Promise<UNSAFE_DataWithResponseInit<unknown>>;

// TODO: Figure out how to use the Route.LoaderArgs from userland code
export type LoaderFunctionArgs = CreateServerLoaderArgs<RouteInfo>;
Expand Down
Loading