Skip to content

chore: re-export zod types in plugins#6268

Closed
jslno wants to merge 1 commit intobetter-auth:canaryfrom
jslno:chore/re-export-zod-in-plugins
Closed

chore: re-export zod types in plugins#6268
jslno wants to merge 1 commit intobetter-auth:canaryfrom
jslno:chore/re-export-zod-in-plugins

Conversation

@jslno
Copy link
Copy Markdown
Contributor

@jslno jslno commented Nov 24, 2025

Related: #6230

The inferred type of 'auth' cannot be named without a reference to '.pnpm/zod@4.1.13/node_modules/zod'. This is likely not portable. A type annotation is necessary. (ts 2742)


Summary by cubic

Re-export Zod types from the plugins entry to prevent non-portable type errors (TS2742) in consumers. Consumers can access z via @better-auth/plugins without importing zod directly. Related to #6230.

  • Bug Fixes
    • Added export type * as z from "zod" in plugins index to avoid .pnpm path references when inferring types like auth (TS2742).

Written for commit d262f1b. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings November 24, 2025 15:39
@vercel
Copy link
Copy Markdown

vercel bot commented Nov 24, 2025

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

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Nov 24, 2025

Open in StackBlitz

better-auth

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

@better-auth/cli

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

@better-auth/core

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

@better-auth/expo

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

@better-auth/passkey

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

@better-auth/scim

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

@better-auth/sso

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

@better-auth/stripe

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

@better-auth/telemetry

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

commit: d262f1b

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 addresses a TypeScript portability error (TS2742) by re-exporting zod types from the plugins index file. The error occurs because plugin exports reference zod types without making them available to consumers.

Key Changes:

  • Re-exports zod types from the plugins index to make type references portable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

createAuthMiddleware,
optionsMiddleware,
} from "@better-auth/core/api";
export type * as z from "zod";
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The zod type export pattern is inconsistent with the main index.ts file. In src/index.ts, zod types are exported more comprehensively with export type * from "zod", export type * from "zod/v4", and export type * from "zod/v4/core" (lines 25-28). For consistency and to ensure all zod types are properly available, consider using the same pattern here: export type * from "zod"; instead of export type * as z from "zod";. The * as z form creates a namespace, while * directly exports all types.

Suggested change
export type * as z from "zod";
export type * from "zod";

Copilot uses AI. Check for mistakes.
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 1 file

Copy link
Copy Markdown
Contributor

@himself65 himself65 left a comment

Choose a reason for hiding this comment

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

I think we already re-export this in the root module. 🤔

@jslno
Copy link
Copy Markdown
Contributor Author

jslno commented Nov 24, 2025

You're right, my bad. I was 1 version behind. It's fixed on LTS

@jslno jslno closed this Nov 24, 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.

4 participants