Skip to content

Commit 5d67bd8

Browse files
fix: docs: 140-shared-extensions.mdx: fix example (#6966)
* docs: fix: correct variable usage in shared extension example * Update content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx --------- Co-authored-by: Ankur Datta <[email protected]>
1 parent 87f140f commit 5d67bd8

File tree

1 file changed

+5
-4
lines changed
  • content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions

1 file changed

+5
-4
lines changed

content/200-orm/200-prisma-client/300-client-extensions/140-shared-extensions/index.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ To import the `find-or-create` extension from the example above, and wrap your c
2929

3030
```ts
3131
import findOrCreate from 'prisma-extension-find-or-create'
32-
33-
const prisma = new PrismaClient().$extends(findOrCreate)
34-
const user = await prisma.user.findOrCreate()
32+
import { PrismaClient } from '../generated/prisma/client'
33+
const prisma = new PrismaClient()
34+
const xprisma = prisma.$extends(findOrCreate)
35+
const user = await xprisma.user.findOrCreate()
3536
```
3637

37-
When you call a method in an extension, use the constant name from your `$extends` statement, not `prisma`. In the above example,`xprisma.user.findOrCreate` works, but `prisma.user.findOrCreate` does not, because the original `prisma` is not modified.
38+
When you call a method in an extension, use the constant name from your `$extends` statement, not `prisma`. In the above example, `xprisma.user.findOrCreate` works, but `prisma.user.findOrCreate` does not, because the original `prisma` is not modified.
3839

3940
## Create a shareable extension
4041

0 commit comments

Comments
 (0)