Better AuthBA
Better Authβ€’5mo ago
n00ki

TypeScript error with sveltekitCookies after updating to v1.3.4

Hey everyone! πŸ‘‹
I'm experiencing a TypeScript error with the sveltekitCookies plugin, which seems like a regression after updating to the latest versions.

I'm getting a type mismatch error when using sveltekitCookies(getRequestEvent):
Argument of type '() => RequestEvent<LayoutParams<"/">, any>' is not assignable to parameter of type '() => RequestEvent<Partial<Record<string, string>>, string | null>'.


This started happening after updating to the latest version, which includes a change to sveltekitCookies (no longer requires a Promise). I guess i can use as any with a @ts-ignore comment for now, but I'm looking for the proper solution.

I believe this error is triggered by TypeScript's strict flag. specifically, the strictNullChecks option.
Is this a known breaking change in the recent version?
Should the type signature be updated, or is there a different recommended approach?

  • Better-Auth version: ^1.3.4
  • SvelteKit version: ^2.26.1
  • Using TypeScript in strict mode
  • Have svelteKitHandler properly configured in hooks.server.ts
  • Need the plugin specifically for server action cookie handling
Any guidance would be much appreciated! πŸ™
Was this page helpful?