[PR #6340] [CLOSED] fix: correct TypeScript return types for server-side auth.api.* methods #32204

Closed
opened 2026-04-17 23:03:10 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6340
Author: @phillipplum
Created: 11/26/2025
Status: Closed

Base: canaryHead: fix/api-return-types


📝 Commits (2)

  • 31592db fix: correct TypeScript return types for server-side auth.api.* methods
  • 6948bd0 Merge branch 'canary' into fix/api-return-types

📊 Changes

1 file changed (+66 additions, -2 deletions)

View changed files

📝 packages/better-auth/src/types/api.ts (+66 -2)

📄 Description

Closes #6332


Summary by cubic

Fixes incorrect TypeScript return types for server-side auth.api.* methods so default calls return parsed data, not Response. Aligns endpoint typings with actual behavior and addresses #6332.

  • Bug Fixes
    • Updated InferAPI to transform endpoints: default returns data; asResponse: true returns Response.
    • Added typed support for returnHeaders and returnStatus flags to return { headers, response } and/or { status, response }.
    • Preserved getSession typing via InferSessionAPI by excluding it from the transformation.

Written for commit 6948bd0b88. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6340 **Author:** [@phillipplum](https://github.com/phillipplum) **Created:** 11/26/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/api-return-types` --- ### 📝 Commits (2) - [`31592db`](https://github.com/better-auth/better-auth/commit/31592dbea69df067828a5c589b1be330b4d0822c) fix: correct TypeScript return types for server-side auth.api.* methods - [`6948bd0`](https://github.com/better-auth/better-auth/commit/6948bd0b88d0a0575bf47088631ccd581550b748) Merge branch 'canary' into fix/api-return-types ### 📊 Changes **1 file changed** (+66 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/types/api.ts` (+66 -2) </details> ### 📄 Description Closes #6332 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes incorrect TypeScript return types for server-side auth.api.* methods so default calls return parsed data, not Response. Aligns endpoint typings with actual behavior and addresses #6332. - **Bug Fixes** - Updated InferAPI to transform endpoints: default returns data; asResponse: true returns Response. - Added typed support for returnHeaders and returnStatus flags to return { headers, response } and/or { status, response }. - Preserved getSession typing via InferSessionAPI by excluding it from the transformation. <sup>Written for commit 6948bd0b88d0a0575bf47088631ccd581550b748. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 23:03:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#32204