diff --git a/src/lib/utils.ts b/src/lib/utils.js similarity index 56% rename from src/lib/utils.ts rename to src/lib/utils.js index 141b9ac..5ceeb29 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.js @@ -1,24 +1,15 @@ -import { clsx, type ClassValue } from "clsx"; +import { clsx } from "clsx"; import { twMerge } from "tailwind-merge"; -import mongoose, { Mongoose } from "mongoose"; +import mongoose from "mongoose"; -export function cn(...inputs: ClassValue[]): string { +export function cn(...inputs) { return twMerge(clsx(inputs)); } -interface Cached { - conn: Mongoose | null; - promise: Promise | null; -} +const cached = global.mongoose || { conn: null, promise: null }; -declare global { - var mongoose: Cached | undefined; -} - -let cached: Cached = global.mongoose || { conn: null, promise: null }; - -export async function connectDB(): Promise { - const DATABASE_URL = process.env.MONGO_URI as string; +export async function connectDB() { + const DATABASE_URL = process.env.MONGO_URI; if (cached.conn) { return cached.conn;