realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Minor enhancement: Loosen the `User` generic type constrains when taking `User` as argument

Open kraenhansen opened this issue 3 years ago • 0 comments

The typescript declaration for User takes two generic types allow users to instantiate an app which returns users that expose type guarantees for the "Realm Functions" and "Custom data" they expose.

We also have a couple of APIs taking User as an argument (switchUser, removeUser, etc.), they are currently restricted to user objects that take only the bound generic types that the App has, but since the implementation of those methods doesn't depend these types, we could loosen them to make it easier for end-users to store a const user: User = app.currentUser; (notice the missing generics on the User here) and pass that into these App methods.

kraenhansen avatar Feb 08 '22 08:02 kraenhansen