How to properly create a typed "me" query result with multiple user types #8167
Unanswered
angelhodar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone! I am converting a JS project to TS and im having doubts with one query which returns a different type of user depending on the user logged in. The query had this aspect when using JS:
All user types inherits from interface User. To get types for each user specific fields I have created a named fragment for each one and I also had to include the common user fields in another fragment that i spread. Like this:
So now i can cast the data result of the query to CurrentUserTypeX to get all the props typed. The thing is that i dont like this approeach because im sure it can be resolved in a cleaner way. Do you have any ideas?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions