I'm getting this error
error TS2694: Namespace 'NodeJS' has no exported member 'Global'.
4 interface CustomNodeJsGlobal extends NodeJS.Global
While running this
import { PrismaClient } from "@prisma/client";
// add prisma to the NodeJS global type
interface CustomNodeJsGlobal extends NodeJS.Global {
prisma: PrismaClient;
}
// Prevent multiple instances of Prisma Client in development
declare const global: CustomNodeJsGlobal;
const prisma = global.prisma || new PrismaClient();
if (process.env.NODE_ENV === "development") global.prisma = prisma;
export default prisma;
IT'S THE PROBLEM WITH @types/node VERSION.
--> With "@types/node": "^15.4.0" (i don't remember precisely but it started from 15 (15.x.x))
--> The error is shown after updating to the latest version "@types/node": "^16.3.0"
What is the standard way to make it work with the latest version "@types/node": "^16.3.0", ?