storage
storage copied to clipboard
data type is changing between `.hset()` and `.hget()`
.hget() does not return the type that has been set with .hset()
await kv.hset(`key`, { code1: '123456', code2: '000001' }) // code is a string
const value = await kv.hgetall(`key`)
console.log(typeof value.code1) // code is a number
console.log(typeof value.code2) // code is a string
With automaticDeserialization: false as mentioned here: https://github.com/vercel/storage/issues/250
console.log(typeof value) // value is an 'object'
console.log(typeof value.code) // code is undefined
console.log(typeof JSON.parse(value)) // is not a valid JSON