tRPCttRPC
Powered by
kevinka.K
tRPC•3y ago
kevinka.

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

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..
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

query params ts error
Answer OverflowAAnswer Overflow / ❓-help
3y ago
how to persist the query client?
ygor perezYygor perez / ❓-help
3y ago
Type '{}' is not assignable in server query
agiAagi / ❓-help
3y ago
TS(2742) error when trying to create client
ViridianVViridian / ❓-help
3y ago