updateUser and updateSession typings broken for client #2947

Closed
opened 2026-03-13 10:29:27 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @devlsh on GitHub (Mar 1, 2026).

Originally assigned to: @himself65 on GitHub.

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

import { createAuthClient } from 'better-auth/react';

const authClient = createAuthClient();

// both have `any` as their types
authClient.updateUser;
authClient.updateSession;

Current vs. Expected behavior

the updateUser and updateSession typings should be valid rather than any

What version of Better Auth are you using?

1.5.0

System info

{
  "system": {
    "platform": "linux",
    "arch": "x64",
    "version": "-",
    "release": "6.12.74-1-lts",
    "cpuCount": 16,
    "cpuModel": "AMD Ryzen 7 7840U w/ Radeon  780M Graphics",
    "totalMemory": "54.73 GB",
    "freeMemory": "48.84 GB"
  },
  "node": {
    "version": "v24.13.1",
    "env": "development"
  },
  "packageManager": {
    "name": "pnpm",
    "version": "10.30.3"
  },
  "frameworks": [
    {
      "name": "react",
      "version": "^19.2.4"
    },
    {
      "name": "hono",
      "version": "^4.12.3"
    }
  ],
  "databases": [
    {
      "name": "postgres",
      "version": "^3.4.8"
    },
    {
      "name": "drizzle",
      "version": "beta"
    },
    {
      "name": "@neondatabase/serverless",
      "version": "^1.0.2"
    }
  ],
  "betterAuth": {
    "version": "1.5.0",
    "config": null,
    "error": "the cli fails to fetch this info - added version manually, and client isn't inferring anything from server config"
  }
}

Which area(s) are affected? (Select all that apply)

Client, Types

Auth config (if applicable)


Additional context

i've tried pruning my lockfile + node_modules folders and removing any plugins to keep it barebones (per the repro), but nothing has helped - worked fine before upgrading to 1.5.0

Originally created by @devlsh on GitHub (Mar 1, 2026). Originally assigned to: @himself65 on GitHub. ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce ```typescript import { createAuthClient } from 'better-auth/react'; const authClient = createAuthClient(); // both have `any` as their types authClient.updateUser; authClient.updateSession; ``` ### Current vs. Expected behavior the `updateUser` and `updateSession` typings should be valid rather than `any` ### What version of Better Auth are you using? 1.5.0 ### System info ```bash { "system": { "platform": "linux", "arch": "x64", "version": "-", "release": "6.12.74-1-lts", "cpuCount": 16, "cpuModel": "AMD Ryzen 7 7840U w/ Radeon 780M Graphics", "totalMemory": "54.73 GB", "freeMemory": "48.84 GB" }, "node": { "version": "v24.13.1", "env": "development" }, "packageManager": { "name": "pnpm", "version": "10.30.3" }, "frameworks": [ { "name": "react", "version": "^19.2.4" }, { "name": "hono", "version": "^4.12.3" } ], "databases": [ { "name": "postgres", "version": "^3.4.8" }, { "name": "drizzle", "version": "beta" }, { "name": "@neondatabase/serverless", "version": "^1.0.2" } ], "betterAuth": { "version": "1.5.0", "config": null, "error": "the cli fails to fetch this info - added version manually, and client isn't inferring anything from server config" } } ``` ### Which area(s) are affected? (Select all that apply) Client, Types ### Auth config (if applicable) ```typescript ``` ### Additional context i've tried pruning my lockfile + `node_modules` folders and removing any plugins to keep it barebones (per the repro), but nothing has helped - worked fine before upgrading to `1.5.0`
GiteaMirror added the bug label 2026-03-13 10:29:27 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 1, 2026):

This looks like a known type inference issue that affected versions around 1.4.9–1.5.0. A few things to try:

  1. Upgrade to a newer versionSeveral type inference fixes were released after 1.5.0, including PR #7618 which simplified type definitions. The updateSession client method was added in 1.5.1, so you may be seeing any because it didn't exist as a core method in 1.5.0.

  2. Check your tsconfig.json – Ensure you have:

    {
      "moduleResolution": "bundler" // or "nodenext", but NOT "node"
    }
    
  3. Verify zod is installed – Missing zod dependency can cause types to collapse to any.

  4. Try restarting your TypeScript server – Sometimes the TS server caches stale types. In VS Code: Cmd/Ctrl + Shift + P → "TypeScript: Restart TS Server"

If you're using any plugins (especially SSO), note that some plugin types have known issues that can cause downstream type inference to collapse to any.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Mar 1, 2026): <!-- Answer --> This looks like a known type inference issue that affected versions around 1.4.9–1.5.0. A few things to try: 1. **Upgrade to a newer version** – [Several type inference fixes were released after 1.5.0](https://github.com/better-auth/better-auth/issues/6965#issuecomment-3688084737), including [PR #7618](https://github.com/better-auth/better-auth/pull/7618) which simplified type definitions. The `updateSession` client method [was added in 1.5.1](https://github.com/better-auth/better-auth/pull/8084), so you may be seeing `any` because it didn't exist as a core method in 1.5.0. 2. **Check your `tsconfig.json`** – Ensure you have: ```json { "moduleResolution": "bundler" // or "nodenext", but NOT "node" } ``` 3. **Verify `zod` is installed** – Missing `zod` dependency can cause types to collapse to `any`. 4. **Try restarting your TypeScript server** – Sometimes the TS server caches stale types. In VS Code: `Cmd/Ctrl + Shift + P` → "TypeScript: Restart TS Server" If you're using any plugins (especially SSO), note that [some plugin types have known issues](https://github.com/better-auth/better-auth/issues/7219#issuecomment-3728789321) that can cause downstream type inference to collapse to `any`. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b1d0876b-2549-49df-8011-4f935f1f5712?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b1d0876b-2549-49df-8011-4f935f1f5712?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b1d0876b-2549-49df-8011-4f935f1f5712?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b1d0876b-2549-49df-8011-4f935f1f5712?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b1d0876b-2549-49df-8011-4f935f1f5712?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b1d0876b-2549-49df-8011-4f935f1f5712?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b1d0876b-2549-49df-8011-4f935f1f5712?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20looks%20like%20a%20known%20type%20inference%20issue%20that%20affected%20versions%20around%201.4.9%E2%80%931.5.0.%20A%20few%20things%20to%20try%3A%0A%0A1.%20%2A%2AUpgrade%20to%20a%20newer%20version%2A%2A%20%E2%80%93%20%5BSeveral%20type%20inference%20fixes%20were%20released%20after%201.5.0%5D%28https%3A//github.com/better-auth/better-auth/issues/6965%23issuecomment-3688084737%29%2C%20including%20%5BPR%20%237618%5D%28https%3A//github.com/better-auth/better-auth/pull/7618%29%20which%20simplified%20type%20definitions.%20The%20%60updateSession%60%20client%20method%20%5Bwas%20added%20in%201.5.1%5D%28https%3A//github.com/better-auth/better-auth/pull/8084%29%2C%20so%20you%20may%20be%20seeing%20%60any%60%20because%20it%20didn%27t%20exist%20as%20a%20core%20method%20in%201.5.0.%0A%0A2.%20%2A%2ACheck%20your%20%60tsconfig.json%60%2A%2A%20%E2%80%93%20Ensure%20you%20have%3A%0A%20%20%20%60%60%60json%0A%20%20%20%7B%0A%20%20%20%20%20%22moduleResolution%22%3A%20%22bundler%22%20//%20or%20%22nodenext%22%2C%20but%20NOT%20%22node%22%0A%20%20%20%7D%0A%20%20%20%60%60%60%0A%0A3.%20%2A%2AVerify%20%60zod%60%20is%20installed%2A%2A%20%E2%80%93%20Missing%20%60zod%60%20dependency%20can%20cause%20types%20to%20collapse%20to%20%60any%60.%0A%0A4.%20%2A%2ATry%20restarting%20your%20TypeScript%20server%2A%2A%20%E2%80%93%20Sometimes%20the%20TS%20server%20caches%20stale%20types.%20In%20VS%20Code%3A%20%60Cmd/Ctrl%20%2B%20Shift%20%2B%20P%60%20%E2%86%92%20%22TypeScript%3A%20Restart%20TS%20Server%22%0A%0AIf%20you%27re%20using%20any%20plugins%20%28especially%20SSO%29%2C%20note%20that%20%5Bsome%20plugin%20types%20have%20known%20issues%5D%28https%3A//github.com/better-auth/better-auth/issues/7219%23issuecomment-3728789321%29%20that%20can%20cause%20downstream%20type%20inference%20to%20collapse%20to%20%60any%60.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/8258)
Author
Owner

@devlsh commented on GitHub (Mar 1, 2026):

1. **Upgrade to a newer version** – [Several type inference fixes were released after 1.5.0](https://github.com/better-auth/better-auth/issues/6965#issuecomment-3688084737), including [PR #7618](https://github.com/better-auth/better-auth/pull/7618) which simplified type definitions. The `updateSession` client method [was added in 1.5.1](https://github.com/better-auth/better-auth/pull/8084), so you may be seeing `any` because it didn't exist as a core method in 1.5.0.

there are no releases after 1.5.0 yet, and the updateSession method was introduced in 1.5.0

2. **Check your `tsconfig.json`** – Ensure you have:
   {
     "moduleResolution": "bundler" // or "nodenext", but NOT "node"
   }

i use this resolution setting already

3. **Verify `zod` is installed** – Missing `zod` dependency can cause types to collapse to `any`.

it is installed

4. **Try restarting your TypeScript server** – Sometimes the TS server caches stale types. In VS Code: `Cmd/Ctrl + Shift + P` → "TypeScript: Restart TS Server"

this isn't a ts server caching issue

@devlsh commented on GitHub (Mar 1, 2026): > 1. **Upgrade to a newer version** – [Several type inference fixes were released after 1.5.0](https://github.com/better-auth/better-auth/issues/6965#issuecomment-3688084737), including [PR #7618](https://github.com/better-auth/better-auth/pull/7618) which simplified type definitions. The `updateSession` client method [was added in 1.5.1](https://github.com/better-auth/better-auth/pull/8084), so you may be seeing `any` because it didn't exist as a core method in 1.5.0. there are no releases after 1.5.0 yet, and the `updateSession` method was introduced in 1.5.0 > 2. **Check your `tsconfig.json`** – Ensure you have: > { > "moduleResolution": "bundler" // or "nodenext", but NOT "node" > } i use this resolution setting already > 3. **Verify `zod` is installed** – Missing `zod` dependency can cause types to collapse to `any`. it is installed > 4. **Try restarting your TypeScript server** – Sometimes the TS server caches stale types. In VS Code: `Cmd/Ctrl + Shift + P` → "TypeScript: Restart TS Server" this isn't a ts server caching issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2947