Description
Link to reproduction
No response
Describe the Bug
When using the website template with PostgreSQL as the database, a type error occurs during pnpm run build. The error is related to the user object passed to createLocalReq() in src/app/(frontend)/next/seed/route.ts.
Error:
Type error: Type 'User & { collection: "users"; }' is not assignable to type 'User | null | undefined'. Type 'User & { collection: "users"; }' is not assignable to type 'User'. Type 'User & { collection: "users"; }' is not assignable to type 'BaseUser'. Types of property 'sessions' are incompatible. Type '{ id: string; createdAt?: string | null | undefined; expiresAt: string; }[] | null | undefined' is not assignable to type 'UserSession[] | undefined'. Type 'null' is not assignable to type 'UserSession[] | undefined'.
To Reproduce
pnpx create-payload-app@latest
- Choose:
- Template:
website
- Database:
PostgreSQL
- Then run:
pnpm install pnpm run build
- Build fails with type error in
src/app/(frontend)/next/seed/route.ts
Node.js version: v22.16.0
Payload Version
3.44.0
Adapters and Plugins
db-postgres