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

Dates (and other types) are serializable when using Deno KV but not islands #2325

Open
skybrian opened this issue Feb 20, 2024 · 1 comment

Comments

@skybrian
Copy link

Thought I'd describe something that's not exactly a bug, but can be confusing: there are differences between what can be serialized using Deno KV and what you can send to an island.

Let's say I have something like this:

type Message = {
  text: string,
  created: Date
}

This will serialize to Deno KV, but when I send it to an Island, the date will be converted to a string using Date's toJSON() method.

However, it type-checks fine. You won't notice any problem until runtime.

It would be convenient if the serialization used by islands were extended to dates and other types that KV can serialize. But when that's not feasible, it seems like there should be some kind of linter warning about types that won't serialize as you expect?

@marvinhagemeister
Copy link
Collaborator

Adding support for serializing days objects makes sense. We can't add long rules for this as it would require the linter to be aware of types, which it doesn't support. It just checks the AST tree.

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

2 participants