t
tRPC
t
tRPC
SerializeObject<UndefinedToOptional<{ position: number; orientation: number;}>>
Original message was deleted
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,111
Members
View on Discord
N
Nick
•
2/8/23, 10:11 AM
This is normal when you don
't have a transformer set
, it turns your types into a type which will survive normal JSON deserialisation
N
Nick
•
2/8/23, 10:21 AM
Yes exactly
, all types get wrapped when you haven
't set a transformer
, because things like Date will become string
N
Nick
•
2/8/23, 10:22 AM
transformers are recommended in the docs
N
Nick
•
2/8/23, 10:46 AM
If you
’re using createCaller for testing then there
’s no network layer so I imagine you don
’t get the types wrapped
N
Nick
•
2/8/23, 1:55 PM
You won
't get any new behaviour from the defaultTransformer anyway
N
Nick
•
2/8/23, 1:55 PM
You need superjson
N
Nick
•
2/8/23, 2:13 PM
You don
't have to use a transformer
, your types will just show up with those wrappers and if you haven
't used special types they
'll be structurally the same
N
Nick
•
2/8/23, 2:14 PM
superjson obviously has to do synchronous work so has overhead
, but it
's not slow enough to worry about it
.
N
Nick
•
2/8/23, 3:22 PM
Ah yes
, that makes sense
. I think it was added in 10
.7 or something
(don
't quote me on that
)
N
Nick
•
2/8/23, 3:23 PM
The behaviour was always there
, just the types were lying I believe