tRPCttRPC
Powered by
rdR
tRPC•3y ago•
10 replies
rd

JSON inferred router output not matching

Hello. I have a procedure query which is returning Json from a postgresql db using Prisma. The type in the query on the server is showing up as
JsonValue
JsonValue
(definitions below).

The inferred type from the
router.procedure.query()
router.procedure.query()
on a
createTRPCProxyClient
createTRPCProxyClient
instance comes back as expected, but the type definition using
inferRouterOutputs<AppRouter>
inferRouterOutputs<AppRouter>
types the Json data as
string | null
string | null
.

Any ideas? Thanks. New to tRPC so sorry if this is a no-brainer.

type JsonObject = { [Key in string]?: JsonValue };
interface JsonArray extends Array<JsonValue> {}
type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
type JsonObject = { [Key in string]?: JsonValue };
interface JsonArray extends Array<JsonValue> {}
type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
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

Router output types not mapping?
hashwarpHhashwarp / ❓-help
2y ago
Typescript helper for router output
Chris JaydenCChris Jayden / ❓-help
3y ago
how can i create a router off of a JSON?
ididitIididit / ❓-help
2y ago
tRPC router won't return, unless it's just json.
PaddyPPaddy / ❓-help
3y ago