NextJS Middleware session types are wrong #71

Closed
opened 2026-03-13 07:30:59 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @Jo9871 on GitHub (Oct 14, 2024).

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). 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 bug label 2026-03-13 07:30:59 -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#71