#TS KV Example

1 messages · Page 1 of 1 (latest)

frozen whale
#

I managed to introduce my KV in bindings.d.ts so the types returned from KV.list are not unknown now. This broke my app horribly as I was taking shortcuts with mapping the result to any[]. Is there any good example of reading data from KV into typed objects? I guess I'll figure it out in the end, but if there is a good sample code, it would help a lot.

#

Also, the original state was without bindings, using context.KV as it is in examples and ignoring TS errors.

slate mango
#

I use Zod to validate the data I receive from KV