Skip to content

fix(org): update type to include undefined#5003

Merged
himself65 merged 1 commit intobetter-auth:canaryfrom
himself65:himself65/2025/09/30/org-exact-opitonal
Sep 30, 2025
Merged

fix(org): update type to include undefined#5003
himself65 merged 1 commit intobetter-auth:canaryfrom
himself65:himself65/2025/09/30/org-exact-opitonal

Conversation

@himself65
Copy link
Copy Markdown
Contributor

@himself65 himself65 commented Sep 30, 2025

Fixes: #4804


Summary by cubic

Update organization route types to correctly treat optional fields as possibly undefined. This fixes TypeScript inference issues and prevents errors when optional values are omitted.

  • Bug Fixes
    • Mark organizationId as string | undefined across access control, invites, members, and organization update.
    • Allow undefined for roleName and permission in updateOrgRole.
    • Mark teamId as string | undefined when teams are enabled in addMember.
    • Add typed metadata query for listOrgRoles with optional organizationId.

Copilot AI review requested due to automatic review settings September 30, 2025 21:26
@himself65 himself65 requested a review from Bekacru as a code owner September 30, 2025 21:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes TypeScript type definitions by explicitly adding | undefined to optional string properties across organization-related route handlers. The changes address type safety issues where optional properties needed explicit undefined typing for better type inference.

  • Updates organizationId, teamId, permission, and roleName optional properties to explicitly include undefined in their union types
  • Adds missing metadata type inference for the listOrgRoles query parameters

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crud-org.ts Updates organizationId type to include explicit undefined
crud-members.ts Updates organizationId and teamId types to include explicit undefined
crud-invites.ts Updates organizationId type to include explicit undefined
crud-access-control.ts Updates multiple optional properties and adds missing metadata for listOrgRoles

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Sep 30, 2025

Open in StackBlitz

better-auth

npm i https://pkg.pr.new/better-auth/better-auth@5003

@better-auth/cli

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@5003

@better-auth/core

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/core@5003

@better-auth/expo

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/expo@5003

@better-auth/sso

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/sso@5003

@better-auth/stripe

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/stripe@5003

commit: f98efd0

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 30, 2025

@himself65 is attempting to deploy a commit to the better-auth Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@himself65 himself65 merged commit 61b446a into better-auth:canary Sep 30, 2025
8 of 10 checks passed
himself65 added a commit to himself65/better-auth that referenced this pull request Oct 2, 2025
himself65 added a commit to himself65/better-auth that referenced this pull request Oct 2, 2025
@better-auth better-auth locked as resolved and limited conversation to collaborators Apr 1, 2026
@bytaesu bytaesu added the locked Locked conversations after being closed for 7 days label Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked Locked conversations after being closed for 7 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues with exactOptionalPropertyTypes when using server API from organization plugin

3 participants