meow
meow
TtRPC
Created by meow on 7/16/2023 in #❓-help
TRPC Vanilla Client (T3 stack)
I'm using the T3 stack (Next + TRPC + etc) and I'm trying to figure out how to do vanilla queries that don't come with the baggage of a hook.
const hello = await api.example.hello.useQuery()
const hello = await api.example.hello.useQuery()
4 replies
TtRPC
Created by meow on 4/12/2023 in #❓-help
Enrich the response object for TRPC endpoint
Currently when I hit a trpc endpoint I get something like:
{
result: {
data: ...
}
}
{
result: {
data: ...
}
}
Is there any way to add more metadata, like:
{
result: {
data: ...
}
meta: {
time: 10ms,
}
}
{
result: {
data: ...
}
meta: {
time: 10ms,
}
}
5 replies
TtRPC
Created by meow on 4/10/2023 in #❓-help
TypeScript type for request object for route handlers
So far I've been writing my routes like:
export const router = t.router({
helloWorld: t.procedure.query(async (req) => "Hello World"),
})
export const router = t.router({
helloWorld: t.procedure.query(async (req) => "Hello World"),
})
What would be the type for req if I wanted to extract my handlers like so:
const handler = async (req:?) => "Hello World"

export const router = t.router({
helloWorld: t.procedure.query(hander)
})
const handler = async (req:?) => "Hello World"

export const router = t.router({
helloWorld: t.procedure.query(hander)
})
4 replies