#Type not portable

2 messages · Page 1 of 1 (latest)

wary steeple
#

Hey everyone, I am extending the default prisma client in a monorepo but I am getting an error saying type is not portable.

import { PrismaClient } from '@company-name/prisma';
import extension from 'prisma-paginate';


const p: PrismaClient = new PrismaClient({
  errorFormat: 'pretty',
  log: ['info'],
  datasources: {
    db: {
      url: process.env.POOLED_DATABASE_URL || process.env.DATABASE_URL,
    },
  },
});
const extendedP = p.$extends(extension);
export const prisma= extendedP;

the export in last line gives me an error saying The inferred type of 'prisma' cannot be named without a reference to '../../../../packages/prisma/node_modules/@prisma/client/runtime/library'. This is likely not portable. A type annotation is necessary.

wary steeple
#

Fixed by installing @prisma/client locally and replace the PrismaClient from @company-name/prisma to @prisma/client