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

Make handlers support DynamicClientExtension #75

Open
mshd opened this issue Nov 8, 2023 · 3 comments
Open

Make handlers support DynamicClientExtension #75

mshd opened this issue Nov 8, 2023 · 3 comments

Comments

@mshd
Copy link
Contributor

mshd commented Nov 8, 2023

currently the default handler has a type conflict with
new PrismaClient({}).$extends({

@mmxdr
Copy link

mmxdr commented May 27, 2024

hi, im facing the same issue

const prismaClientSingleton = () => {
  const prismaClient = new PrismaClient().$extends({
    result: {
      image: {
        url: {
          needs: { fileName: true },
          compute(image) {
            return `${process.env.NEXT_PUBLIC_HOST}/attachments/${image.fileName}`;
          },
        },
      },
    },
  });

  return prismaClient;
};

Argument of type 'DynamicClientExtensionThis<TypeMap<InternalArgs & { result: { image: { url: () => { needs: { fileName: true; }; compute(image: { fileName: string; }): string; }; }; }; model: {}; query: {}; client: {}; }>, TypeMapCb, { ...; }>' is not assignable to parameter of type 'PrismaClient<PrismaClientOptions, never, DefaultArgs>'.

@ogroppo
Copy link
Contributor

ogroppo commented May 28, 2024

yes there should be a solution that works for all versions... will have a look this month

@ogroppo
Copy link
Contributor

ogroppo commented Jul 30, 2024

Still looking into it, version 5.2.1 did not fix. for now casting the client to as PrismaClient does the job.

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

No branches or pull requests

3 participants