realm-js
realm-js copied to clipboard
Generic type for toJSON
Problem
In our application, we're using .toJSON a lot because we work with immutability and so we copy the data by using js spreading operation and when the spreading takes place the data is not available anymore, toJSON solves that problem. I wasn't seeing any problem with using toJSON for that matter, but after upgrading Realm to a newer version, I noticed that the type is returning something different Record<string, unknown>
. Is there a way I could type it without having to force the type? The cast doesn't work here because they are a lot different.
from Realm types folder
current realm version: 11.0.0 current react native version: 0.70.4 current typescript version: 4.8.3
Solution
It would be better if the type was generic instead of Record<string,unknown>
How important is this improvement for you?
Would be a major improvement