deptyped / prisma-extension-pagination

Prisma Client extension for pagination
https://npmjs.com/prisma-extension-pagination
MIT License
243 stars 18 forks source link

Paginate not working in prisma 5 with NestJs #18

Open btd1337 opened 11 months ago

btd1337 commented 11 months ago

When using this library with NestJs, this error occurs:

class UsersRepository {
    constructor(private readonly prisma: PrismaService) {}

    findMany() {
        return this.prisma.users.paginate();  // "The property 'paginate' does not exist on type 'UserDelegate'."
    }
}
// Prisma instantiation

import pagination from 'prisma-extension-pagination';

@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {
    async onModuleInit(): Promise<void> {
        await this.$connect();
        this.$extends(pagination());
  }
}
NestJs: 8.4.7
Typescript: 4.7.4
Prisma: 5.2.0
prisma-extension-pagination: 0.5.0
deptyped commented 11 months ago

@btd1337 seems related to https://github.com/deptyped/prisma-extension-pagination/issues/7

AlexRMU commented 7 months ago

Look at this