Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createManyAndReturn types not what Pal.js is expecting #335

Closed
ZenSoftware opened this issue Jun 8, 2024 · 3 comments · Fixed by #337
Closed

createManyAndReturn types not what Pal.js is expecting #335

ZenSoftware opened this issue Jun 8, 2024 · 3 comments · Fixed by #337

Comments

@ZenSoftware
Copy link

ZenSoftware commented Jun 8, 2024

Hi @AhmedElywa ! 🎐

I just wanted to let you know how my upgrade experience has been going for the new createManyAndReturn feature Prisma released. I've been running into some small issues.

The actual type being generated by Prisma is some kind of super convoluted type for the new createManyAndReturn feature:
paljs-debugging-2

You seem to be expecting the return type for the above to be exported as a declared TypeScript type named CreateManyUserAndReturnOutputType. This type is not being generated for me utilizing @prisma ^5.14.0
paljs-debugging-1

  • Here is a link to my schema.prisma file.
  • Here is a link to my resolversTypes.ts generated by Pal.js CLI. As of today, it is generated via @paljs/cli v6.0.7. I have been blocking my update to @paljs/cli v7.0.0 until I can get this resolved.

Is this type that you are expecting being generated for you?

Thanks a million for your continual maintenance of Pal.js bud. I would not have been able to create my starter kit without your work. 🥂

@AhmedElywa
Copy link
Collaborator

With this new API from Prisma, we add a lot of work on the last version to support it.
Prisma changed the dmmf schema a lot to meet this new API so if you have any issues with this API update paljs to the last version and try it.

@ZenSoftware
Copy link
Author

ZenSoftware commented Jun 8, 2024

Yes, I am utilizing @paljs/cli v7.0.0.

The issue is the type CreateManyUserAndReturnOutputType does not exist within the TypeScript type definition file for my Prisma client. The output for your generation for 'SDL first' is expecting this type within your resolversTypes.ts file that is being generated. 乁(ツ)∫

// This type that you are expecting is missing within my Prisma client's index.d.ts file
Client.Prisma.CreateManyUserAndReturnOutputType

// Modifying my Prisma client's index.d.ts file fixes the problem and I can compile by manually adding this under the Prisma namespace
export type CreateManyUserAndReturnOutputType = Prisma.PrismaPromise<$Result.GetResult<Prisma.$UserPayload<ExtArgs>, T, 'createManyAndReturn'>>;

The last line in the code above is the return type for the createManyAndReturn function. I found it and simply by copy and pasted it as the type for the type CreateManyUserAndReturnOutputType to export.

@f8k8
Copy link
Contributor

f8k8 commented Jul 1, 2024

I'm seeing the same error. It looks like maybe the generator should create something like this instead:
id?: Resolver<ReturnType<Client.Prisma.UserDelegate["createManyAndReturn"]>, {}, string>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants