import { INestApplication, Injectable, OnModuleInit} from '@nestjs/common';
import { Prisma, PrismaClient } from '@prisma/client';
@Injectable()
export class PrismaService extends PrismaClient implements OnModuleInit {
async onModuleInit() {
await this.$connect();
}
async enableShutdownHooks(app: INestApplication) {
this.$on('beforeExit', async () => {
await app.close();
});
}
}
i got error on the line this.$on('beforeExit', async () => { as it was saying Argument of type 'string' is not assignable to parameter of type 'never'
I tried so many things from stackoverflow but couldn't resolved it. Please help me.
It should have work as fine.