From 146f19db554332585b5249a287e88886c7ab8170 Mon Sep 17 00:00:00 2001 From: Joseph J Helfenbein Date: Sat, 25 Jan 2025 06:22:09 -0500 Subject: [PATCH] switch to js --- src/lib/{utils.ts => utils.js} | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) rename src/lib/{utils.ts => utils.js} (56%) 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;