t
tRPC
Wrong type for results - tRPC
C
tRPC
•
12mo ago
•
4 replies
coder2000
Wrong type for results
I have a query that has a couple fields with the
Date
Date
type
, however when queried with TanStack they are being returned as
string
string
. Is there a way to cast them to
Date
Date
again
?
Solution
Afaik you need to use a transformer
https://trpc.io/docs/server/data-transformers
Data Transformers | tRPC
You are able to serialize the response data
& input args
. The transformers need to be added both to the server and the client
.
Jump to solution
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
4,951
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Output properties missing on frontend results (Type Infer)
F
FakeTechExec / ❓-help
3y ago
SuperJSON is wrapping results in type with keys "json" and "meta"
D
Dimi / ❓-help
3y ago
queries and mutations has wrong response type in client ( monorepo )
A
Amirreza / ❓-help
2y ago