Skip to content

fix(types): preserve define server auth literals#135

Merged
onmax merged 1 commit intomainfrom
fix/define-server-auth-literal-inference
Feb 14, 2026
Merged

fix(types): preserve define server auth literals#135
onmax merged 1 commit intomainfrom
fix/define-server-auth-literal-inference

Conversation

@onmax
Copy link
Collaborator

@onmax onmax commented Feb 14, 2026

Summary

  • switch defineServerAuth overloads to unconstrained literal inference with ServerAuthConfig validation intersections
  • keep runtime behavior unchanged while preserving nested literals like generateId: 'uuid' and additionalFields.*.type: 'string' without as const
  • mirror the overload strategy in generated type template declarations
  • add regression coverage with positive and negative compile-time assertions for issue 134

Tests

  • pnpm lint
  • pnpm typecheck
  • pnpm vitest run test/define-server-auth-literal-inference.test.ts test/infer-plugins-types.test.ts

Closes #134

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 14, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-modules/better-auth/@onmax/nuxt-better-auth@135

commit: 539c814

@onmax onmax merged commit c9d963d into main Feb 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

defineServerAuth widens literal types despite const generic

1 participant