How to deal with the type of response in sql'' template

How can we deal with the types of sql'' template since the result is accessable from the rows property of result, Unlike the ORM itself.

const { rows } = await db.execute(
    sql`SELECT DISTINCT ${vehicleReferences.manufacturer} FROM ${vehicleReferences} WHERE ${vehicleReferences.vehType} = ${category}`
)

// Mapping the result to get only the brands as an Array
const vehTypes = rows.map((row) => row.manufacturer)

res.json({ brands: vehTypes })


For example rows are not type-safe here and I have to guess row manufacturer
Was this page helpful?