Paul | Blue
Paul | Blue
DTDrizzle Team
Created by Paul | Blue on 1/22/2024 in #help
What's the right way to get the type of a query?
Hi, I have this
export async function findTicketById(ticketId: string) {
const ticket = await db.query.ticketsTable.findFirst({
where: (tickets, { eq }) => eq(tickets.ticketId, ticketId),
with: {
assignedTo: true,
createdBy: true,
user: true,
},
});

return ticket;
}
export async function findTicketById(ticketId: string) {
const ticket = await db.query.ticketsTable.findFirst({
where: (tickets, { eq }) => eq(tickets.ticketId, ticketId),
with: {
assignedTo: true,
createdBy: true,
user: true,
},
});

return ticket;
}
and I'm trying to get the type of the ticket that is given back, which has a few additional types due to the "with" statements. Main reason for this is I want to have a function that cleans the response up before i send it back to the frontend and then i also want to be able to get these types over to my frontend repo. What's the best way to get the type of this query?
5 replies