T
tRPC

❓-help

TS error cause Query is not returning correct type to the client!

Kkevinka7/24/2023
So Ive build a query which return a type called Employee, for example. on my client I've props which are expecting the same type imported from server but after calling the query on the client the data is coming without the "cast" of Employee but an object of the properties of it. Now my typescript is screaming saying "Type {...props from Employee} is not assignable to type 'Employee'." One really important note is I'm using strict mode on my tsconfig. I can remove and follow without this error but the reason I had to add strict to my project is because somehow without it typescript is screaming on the TRPC initialization on client, so..

Looking for more? Join the community!