You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (process.env.NODE_ENV!=='production') globalForPrisma.prisma=prisma
exportdefaultprisma
```
This file creates a Prisma Client and attaches it to the global object so that only one instance of the client is created in your application. This helps resolve issues with hot reloading that can occur when using Prisma ORM with Next.js in development mode.
This code results in a prisma client with a type of any, as well as raising the following errors:
'prisma' is referenced directly or indirectly in its own type annotation. ts(2502)
'prisma' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer .ts(7022)
Description
The following part of the documentation specifies how to create a prisma client that attaches to the global object:
docs/content/800-guides/090-nextjs.mdx
Lines 283 to 298 in 389c943
This code results in a prisma client with a type of any, as well as raising the following errors:
A fix should be made in line 289:
docs/content/800-guides/090-nextjs.mdx
Line 289 in 389c943
Where
{ prisma: typeof prisma }
should become{ prisma: typeof PrismaClient }
.This fix removes the errors as well as makes the exported client type safe.
The text was updated successfully, but these errors were encountered: