diff --git a/.changeset/large-phones-peel.md b/.changeset/large-phones-peel.md new file mode 100644 index 00000000000..8ba55d0e6e9 --- /dev/null +++ b/.changeset/large-phones-peel.md @@ -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. diff --git a/packages/react-router/src/ssr/types.ts b/packages/react-router/src/ssr/types.ts index 10b8a9f855d..072eb783fd8 100644 --- a/packages/react-router/src/ssr/types.ts +++ b/packages/react-router/src/ssr/types.ts @@ -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; @@ -97,7 +97,13 @@ type ObjectLike = Record | null; * * In the case of `null`, we will return an object containing only the authentication state. */ -export type RootAuthLoaderCallbackReturn = Promise | Response | Promise | ObjectLike; +type RootAuthLoaderCallbackReturn = + | Promise + | Response + | Promise + | ObjectLike + | UNSAFE_DataWithResponseInit + | Promise>; // TODO: Figure out how to use the Route.LoaderArgs from userland code export type LoaderFunctionArgs = CreateServerLoaderArgs;