// Inferring type for the findMany argument
type FindManyArg = Parameters<DB['query']['demotable']['findMany']>[0]
// ...
//Setting up the procedure
discordTest: privateProcedure
.input(input => input as FindManyArg)
.query(async ({ input }) => {
const result = await db.query.demotable.findMany(input)
return result
}),
// On the front end,
const { data: demo } = trpc.discordTest.useQuery({
columns: { updatedAt: false }, // <== this is properly typed and intellisense is working
})
console.log(demo?.[0].updatedAt) // <=== does not error
// ============================
// Hardcoding columns does properly reflect on the front end
const result = await db.query.demotable.findMany({
...input,
columns: { updatedAt: false },
})
return result
// On the front end,
const { data: demo } = trpc.discordTest.useQuery({})
console.log(demo?.[0].updatedAt) // <=== errors as expected
// Inferring type for the findMany argument
type FindManyArg = Parameters<DB['query']['demotable']['findMany']>[0]
// ...
//Setting up the procedure
discordTest: privateProcedure
.input(input => input as FindManyArg)
.query(async ({ input }) => {
const result = await db.query.demotable.findMany(input)
return result
}),
// On the front end,
const { data: demo } = trpc.discordTest.useQuery({
columns: { updatedAt: false }, // <== this is properly typed and intellisense is working
})
console.log(demo?.[0].updatedAt) // <=== does not error
// ============================
// Hardcoding columns does properly reflect on the front end
const result = await db.query.demotable.findMany({
...input,
columns: { updatedAt: false },
})
return result
// On the front end,
const { data: demo } = trpc.discordTest.useQuery({})
console.log(demo?.[0].updatedAt) // <=== errors as expected