Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KV Key metadata types to narrow #1238

Open
ckohen opened this issue Aug 10, 2024 · 0 comments
Open

KV Key metadata types to narrow #1238

ckohen opened this issue Aug 10, 2024 · 0 comments

Comments

@ckohen
Copy link

ckohen commented Aug 10, 2024

Between version 3.2.0 and 3.3.0 the type for KV's Key['metadata'] (and MetadataGetResponse) was changed from unknown to Record<string, unknown>.

This type is too narrow, as the metadata can be set to any valid JSON string. Since the value of the metadata is updated as a raw JSON string, this arbitrary nature is very useable. Presumably this is parsed by JSON.parse which respects this behavior. This can either be reverted to unknown, or widened to be a JSONValue type that is essentially most primitives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant