const [user]: T = await db("users").select("*").returning("*");
// error:Type 'T' must have a '[Symbol.iterator]()' method that returns an iterator.
My knex query typescript giving me error when i tried brackets in knex query to return single object from array.Can someone help me understand to why it is showing me this error even when i passed specific generic type and “user” variable is storing a single object as specified by type.Is there any go through from it, I also tried with .first() instead of square brackets but it shows a different error then.
const user: T = await db("users").select("*").first().returning("*");
//error: Type 'any[]' is not assignable to type 'T'.
// 'T' could be instantiated with an arbitrary type which could be unrelated to 'any[]'.