Skip to content

Commit 00daff4

Browse files
fix: update withCloudflare to support generic BetterAuthOptions (#4)
1 parent b33d16d commit 00daff4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ export const getGeolocation = (): CloudflareGeolocation | undefined => {
151151
* @param options - The base BetterAuthOptions to be enhanced.
152152
* @returns BetterAuthOptions configured for use with Cloudflare.
153153
*/
154-
export const withCloudflare = (
155-
cloudFlareOptions: WithCloudflareOptions,
156-
options: BetterAuthOptions
157-
): BetterAuthOptions => {
154+
export const withCloudflare = <T extends BetterAuthOptions>(cloudFlareOptions: WithCloudflareOptions, options: T) => {
158155
const autoDetectIpEnabled =
159156
cloudFlareOptions.autoDetectIpAddress === undefined || cloudFlareOptions.autoDetectIpAddress === true;
160157
const geolocationTrackingForSession =
@@ -194,7 +191,7 @@ export const withCloudflare = (
194191
plugins: [cloudflare(cloudFlareOptions), ...(options.plugins ?? [])],
195192
advanced: updatedAdvanced,
196193
session: updatedSession,
197-
};
194+
} as T;
198195
};
199196

200197
export type SessionWithGeolocation = Session & CloudflareGeolocation;

0 commit comments

Comments
 (0)