dj0024javia
dj0024javiaā€¢15mo 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 šŸ±
Alex / KATT šŸ±ā€¢15mo ago
Not a trpc issue
dj0024javia
dj0024javiaā€¢15mo ago
ok thanks! Loving the TRPC btw.
Ryan
Ryanā€¢15mo 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