You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It has some static methods, but if I call useRxCollection(), there's no good way of TypeScript knowing that. The hook only accepts a single generic which is for the document type (i.e. RxCollection<T>), so I can't provide the types for my static methods.
I think it would make more sense if the generic was for the collection itself, rather than the document type, e.g.:
I realize that's a breaking change, though, so perhaps it would be enough for the function to accept all three generic types? That way, I could at least do this:
+1 similarly, if you define ORM methods on your collection, it doesn't have a way of recognizing that the result documents have those methods available
Hey there!
I've got a collection that looks like this:
It has some static methods, but if I call
useRxCollection()
, there's no good way of TypeScript knowing that. The hook only accepts a single generic which is for the document type (i.e.RxCollection<T>
), so I can't provide the types for my static methods.I think it would make more sense if the generic was for the collection itself, rather than the document type, e.g.:
I realize that's a breaking change, though, so perhaps it would be enough for the function to accept all three generic types? That way, I could at least do this:
Right now, that line of code fails because the second and third generics aren't being passed through.
I'm happy to open a PR if you want, though I think the change would be very quick.
Thanks!
The text was updated successfully, but these errors were encountered: