rocicorp / replicache

Realtime Sync for Any Backend Stack
https://doc.replicache.dev
1.01k stars 37 forks source link

Discrepancies in Typescript declarations #1032

Closed user72356 closed 1 year ago

user72356 commented 1 year ago

I found what I believe are some discrepancies in the Typescript declaration file (replicache.d.ts).

arv commented 1 year ago
user72356 commented 1 year ago
  • PullRequest should not really parameterized. That was an internal implementation detail that leaked. cookie should always be ReadonlyJSONValue which already includes null.

I don't understand this. I'm working with TS in strict mode and I'm not allowing the any type. If PullRequest is an implementation detail that was leaked, how am I to use req.body? By recreating my own type from the documentation?

  • We do not want to support Date. These are things that are JSON as specified on https://json.org. We only want things that round trip. We do not actually use JSON.stringify or toJSON any more.

That's fair, but how do you suggest working with dates? Should I manually (de)serialize them within my own code?

arv commented 1 year ago

PullRequest is not an implementation detail. The thing that was a mistake to "leak" was the type parameter. cookie should always be ReadonlyJSONValue. This has been fixed for the next release. Sorry for the confusion.