Hey guys, I have this weird functionality that hasn't been a thing up until this point and it's the fact that fetching doesn't respect data types as shown in the example below. Unfortunately, this leads to errors and undefined behavior in my code.
This is actually the nextjs template, that if you download and use update it's packages it would work, especially at the strict equalities because of the type ( === and !== ) .
export interface Chat extends Record<string, any> {
id: string
title: string
createdAt: Date | number
userId: string
path: string
messages: Message[]
folder: string | null
sharePath?: string
}
export async function getSharedChat(id: string) {
const chat = await kv.hgetall<Chat>(`chat:${id}`)
console.log (typeof chat?.createdAt, chat!.createdAt); //outputs: string 1701006596925