Repository: deno
Issue: Feature request(ext/kv): Make key and value type definitions globally configurable
Labels: suggestion

It would be nice to be able to genericize Deno.openKv to define global type definitions that can be used throughout KV, like this:

```ts
const kv = await Deno.openKv<[
  { key: ["path", "to", "key"]; value: string; },
  { key: ["path", "to", string]; value: number; },
  { key: ["path", ...string[]]; value: symbol; },
]>();

const { value } = await kv.get(["path", "to", "key"]);
//      ^^^^^ it should be `string | number | symbol | null`

await kv.set(["path", "to", "key"], value); // Type error if value is anything other than `string | number | symbol | null`
```

I have partially implemented this idea. -> [playground](https://www.typescriptlang.org/play?target=99&filetype=ts#code/FAEwpgxgNghgTmABAOxgWzAZwA4wkgETGQHtEBvYRRMAD2xLgBdEAzAV2QiYEsTlEJbMQDSANwA8EfphYBhGrSbEQmROLn9lyJgD4AFLiYALAPwAuRLLg9kAcwCUlgApwSaHpjASipAHTiEnK6ugDcVIoMzIhMAJ7C6mIiYLGIALyICDAg-FCp4smxzvBMANoAuuHUdFEscQkFKcXRGQCqtkwAHACCcHAwqQA+Vkw29ojDyOxoAEZgcBOIMzx2HYszJCRQYDDIVZGMdfFIGjKe2hCxADJgYmBQ6YgARNb8dk+LT7fETOwwUE99jVDjFjokrucAMr3SBMRjpCLUYbkRDYBCsHi0SyNVIAX0RixRaLAGKxiUKoRGJWxSRSiHx1CRFFR6MxNIpNGQIHZdIZjORVOYPNilJUwvpQPoIPqJzEAFl2EwYLx+AjGYgAGTMgDWKXFfOoWv0BKZKJllheYCYgMQYn+7DAlk42tIAHcBAb+czzc9wNtlB9PabQcILZhpja7VAHTTWgA2AAs9JNhJDjueaBgtEj9vT4njSaDqZ9Tw8yBz0bzYgLyfVDkltUQ0BgmDU4ghsgAksp+nC4BIACq6RA8NDYbYYHRqbqYWJcbvzGAzbYL3uMCTiACiOjgsUHIQoBLsVqb7DgmEY+icIzGdnCBOQdCYV5cbg8Xgkq+VjAASlh2FATAbmI26jHuQ4ADSIJw4AYo+IAhPs1ClJCsSzFsfgtnOEBfn25QvogM7YV+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