Closed scotttrinh closed 3 months ago
Don't we know the number of items in the tuple? and their types. Why don't we strictly enumerate those in the generated TS?
select { "a", "b", "c" }
const result: [string, string, string] = await
result[1] // string
result[4] // error / undefined
Don't we know the number of items in the tuple?
We do in a tuple, but this is a set, not a tuple. All we know is the type and cardinality.
Querying for a tuple already does the right thing of returning either a tuple type (for tuples) or an object (for named tuples).
Ah of course 👍
Fixes a TypeScript error where
query
was returningT[]
but the return type of the function as[T, ...T[]]
and TypeScript was rightly complaining that they are incompatible.Fixes #1072