Deno KV Type Error
When I run await (await kv.get<typeThing>(["example"])).id (the value is an object), it returns a type error because it is a maybe type thing.
null, it might be best to check the versionstamp for null, rather than the value. Be aware that some folks might just use the multipart key as both key and data, and just put null in the value field.Property 'id' does not exist on type 'KvEntryMaybe<typeThing>'.
Property 'id' does not exist on type '{ key: KvKey; value: null; versionstamp: null; }'.deno-ts(2339)await kv.get<typeThing>(["example"]) != null!= nullKvEntryMaybe = {key, value, versionstamp}'user_data.value' is possibly 'null'.deno-ts(18047)
(property) value: User | nulllet result = await kv.get<typeThing>(["example"])
// get returns a KvEntryMaybe object = {key, value, versionstamp}
// If (result.value === null) => `key was not found`
if {result.value) console.log(result.value.id);
// no error will be thrown! your error was that 'id' does not exist // on the `KvEntryMaybe` returned by the `get` method.