chore: re-export zod types in plugins#6268
Conversation
|
@jslno is attempting to deploy a commit to the better-auth Team on Vercel. A member of the Team first needs to authorize it. |
better-auth
@better-auth/cli
@better-auth/core
@better-auth/expo
@better-auth/passkey
@better-auth/scim
@better-auth/sso
@better-auth/stripe
@better-auth/telemetry
commit: |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
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.
| export type * as z from "zod"; | |
| export type * from "zod"; |
himself65
left a comment
There was a problem hiding this comment.
I think we already re-export this in the root module. 🤔
|
You're right, my bad. I was 1 version behind. It's fixed on LTS |
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.
Written for commit d262f1b. Summary will update automatically on new commits.