dj0024javia
dj0024javia2y ago

JWT Token is type "never" in frontend.??!!

TRPC Backend is sending JWT Token as string but frontend is reading it as type "never". I am using transformer: superjson on both BE and FE. if i typecast it manually "as string" then it shows correct type. Can someone please confirm if this is an issue or not? Environment -> Node 16.
3 Replies
Alex / KATT 🐱
Not a trpc issue
dj0024javia
dj0024javiaOP2y ago
ok thanks! Loving the TRPC btw.
Ryan
Ryan2y ago
TS can't infer what type of data is in your JWT. You could use Zod to validate the fields you expect and then infer the type from Zod