Confused on types of prisma responses, and how to access the data inside.
The NextAuth 'Account' model in prisma has a 'access_token' property that I need to access for a API call on the server.
However, the only property I can access in the trpc context is the "session" model.
So, what I am doing is querying users for the user that has the session from the context, then getting the account array from that user and getting the account from there.
(1st image)
However, I am running into some issues mainly with the type of what prisma calls return back.
When I hover I get this big type (2nd image) that appears to have a "accounts" property, but then when I hover over accounts I dont get the "Account[]" I expect, instead some long obscure type (3rd image)
however, when simply return the prisma result from trpc (4th image), and do the same thing as before with getting the account on client (5th image) everything works, but id like to keep this all on the server if possible so this isnt ideal.
Im pretty new and probably doing something wrong, any help is greatly appreciated thanks
6 Replies