[GH-ISSUE #167] NextJS Middleware session types are wrong #16786

Closed
opened 2026-04-15 14:45:17 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @Jo9871 on GitHub (Oct 14, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/167

Returns Types from package db schema, when it should infer the types

import type { Session, User } from "../db/schema";

customRedirect?: (
        session: {
            user: User; // Should be InferUser<Option>
            session: Session; // Should be InferSession<Option>
        } | null,
        request: NextRequest,
    ) => Promise<any>;
Originally created by @Jo9871 on GitHub (Oct 14, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/167 Returns Types from package db schema, when it should infer the types ``` import type { Session, User } from "../db/schema"; customRedirect?: ( session: { user: User; // Should be InferUser<Option> session: Session; // Should be InferSession<Option> } | null, request: NextRequest, ) => Promise<any>; ```
GiteaMirror added the lockedbug labels 2026-04-15 14:45:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16786