Typescript: setting an additional field input: false doesn't allow referencing that field when using getFullOrganization #2237

Closed
opened 2026-03-13 09:37:25 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @vehbiu on GitHub (Oct 30, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Using a next-js monorepo, in my organization plugin I have:

        schema: {
            organization: {
                additionalFields: {
                    exampleField: {
                        type: "string",
                        required: false,
                        input: false,
                    },
                }
           }

When I run (on a server action):

    const org = await auth.api.getFullOrganization({
      headers: await headers(),
      query: {
        organizationId,
        membersLimit: 1,
      },
    });

    if (!org) {
      return { error: "Organization not found" };
    }

    console.log(org)

    const exampleField = org.exampleField;

Current vs. Expected behavior

I get the type error

Property 'exampleField' does not exist on type '{ members: { id: string; organizationId: string; role: "member" | "admin" | "owner"; createdAt: Date; userId: string; user: { email: string; name: string; image?: string | undefined; }; }[]; invitations: { ...; }[]; } & { ...; }'.ts(2339)

Despite the field actually existing (even console.log'ing the value shows it)

What version of Better Auth are you using?

1.3.34

System info

{
  "system": {
    "platform": "win32",
    "arch": "x64",
    "version": "Windows 11 Pro",
    "release": "10.0.26100",
    "cpuCount": 12,
    "cpuModel": "AMD Ryzen 5 8645HS w/ Radeon 760M Graphics",
    "totalMemory": "31.27 GB",
    "freeMemory": "17.13 GB"
  },
  "node": {
    "version": "v22.19.0",
    "env": "development"
  },
  "packageManager": {
    "name": "bun",
    "version": "1.3.0"
  },
  "frameworks": [
    {
      "name": "next",
      "version": "^15.5.6"
    },
    {
      "name": "react",
      "version": "^19.2.0"
    }
  ],
  "databases": [
    {
      "name": "postgres",
      "version": "^3.4.7"
    },
    {
      "name": "drizzle",
      "version": "^0.41.0"
    }
  ],
  "betterAuth": {
    "version": "^1.3.34",
    "config": null
  }

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

Types, Backend, Client

Auth config (if applicable)


Additional context

No response

Originally created by @vehbiu on GitHub (Oct 30, 2025). ### Is this suited for github? - [ ] Yes, this is suited for github ### To Reproduce Using a next-js monorepo, in my organization plugin I have: schema: { organization: { additionalFields: { exampleField: { type: "string", required: false, input: false, }, } } When I run (on a server action): ``` const org = await auth.api.getFullOrganization({ headers: await headers(), query: { organizationId, membersLimit: 1, }, }); if (!org) { return { error: "Organization not found" }; } console.log(org) const exampleField = org.exampleField; ``` ### Current vs. Expected behavior I get the type error ``` Property 'exampleField' does not exist on type '{ members: { id: string; organizationId: string; role: "member" | "admin" | "owner"; createdAt: Date; userId: string; user: { email: string; name: string; image?: string | undefined; }; }[]; invitations: { ...; }[]; } & { ...; }'.ts(2339) ``` Despite the field actually existing (even console.log'ing the value shows it) ### What version of Better Auth are you using? 1.3.34 ### System info ```bash { "system": { "platform": "win32", "arch": "x64", "version": "Windows 11 Pro", "release": "10.0.26100", "cpuCount": 12, "cpuModel": "AMD Ryzen 5 8645HS w/ Radeon 760M Graphics", "totalMemory": "31.27 GB", "freeMemory": "17.13 GB" }, "node": { "version": "v22.19.0", "env": "development" }, "packageManager": { "name": "bun", "version": "1.3.0" }, "frameworks": [ { "name": "next", "version": "^15.5.6" }, { "name": "react", "version": "^19.2.0" } ], "databases": [ { "name": "postgres", "version": "^3.4.7" }, { "name": "drizzle", "version": "^0.41.0" } ], "betterAuth": { "version": "^1.3.34", "config": null } ``` ### Which area(s) are affected? (Select all that apply) Types, Backend, Client ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
Author
Owner

@dosubot[bot] commented on GitHub (Oct 30, 2025):

Hi @vehbiu! I'm Dosu and I’m helping the better-auth team.

This is a known limitation in Better Auth v1.3.x: when you set input: false on an additional field in the organization schema, that field is intentionally excluded from the TypeScript output types for things like getFullOrganization, even though it exists at runtime. This is by design in the type utilities—fields with input: false are filtered out to keep types clean, but this can cause type errors if you try to access them directly in TypeScript code, as you’ve seen.

Workarounds include using a type assertion (e.g., org as any or (org as any).exampleField), but this isn’t type-safe. Some teams use the metadata field for extra organization data, or define a custom endpoint if you need type-safe access. These type inference issues are fixed in the 1.4 beta, but the changes aren’t portable back to 1.3.x. More details and discussion are in this issue.

If you want to keep strict typing, you’ll need to avoid relying on input: false additionalFields in the organization schema in 1.3.x, or upgrade to 1.4 beta when possible.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Oct 30, 2025): <!-- Greeting --> Hi @vehbiu! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This is a known limitation in Better Auth v1.3.x: when you set `input: false` on an additional field in the organization schema, that field is intentionally excluded from the TypeScript output types for things like `getFullOrganization`, even though it exists at runtime. This is by design in the type utilities—fields with `input: false` are filtered out to keep types clean, but this can cause type errors if you try to access them directly in TypeScript code, as you’ve seen. Workarounds include using a type assertion (e.g., `org as any` or `(org as any).exampleField`), but this isn’t type-safe. Some teams use the `metadata` field for extra organization data, or define a custom endpoint if you need type-safe access. These type inference issues are fixed in the 1.4 beta, but the changes aren’t portable back to 1.3.x. More details and discussion are in [this issue](https://github.com/better-auth/better-auth/issues/5122). If you want to keep strict typing, you’ll need to avoid relying on `input: false` additionalFields in the organization schema in 1.3.x, or upgrade to 1.4 beta when possible. <!-- 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/2078db0b-3d54-48af-862f-9f84c6abe4d1?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/2078db0b-3d54-48af-862f-9f84c6abe4d1?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/2078db0b-3d54-48af-862f-9f84c6abe4d1?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/2078db0b-3d54-48af-862f-9f84c6abe4d1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/2078db0b-3d54-48af-862f-9f84c6abe4d1?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/2078db0b-3d54-48af-862f-9f84c6abe4d1?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/2078db0b-3d54-48af-862f-9f84c6abe4d1?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&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/5680)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2237