Properly type unnestValues return

This commit is contained in:
2025-11-26 18:44:59 +01:00
parent 5f8ddd435a
commit a45e992339

View File

@@ -155,7 +155,7 @@ export const unnestValues = <
if (!(k in columns)) continue; if (!(k in columns)) continue;
keys.push(k); keys.push(k);
acc[k] = new Array(i).fill(null); acc[k] = new Array(i).fill(null);
acc[k].push(cur[k]) acc[k].push(cur[k]);
} }
return acc; return acc;
}, },
@@ -172,7 +172,11 @@ export const unnestValues = <
x, x,
(columns[x].defaultFn?.() ?? columns[x].onUpdateFn!()).as(dbNames[x]), (columns[x].defaultFn?.() ?? columns[x].onUpdateFn!()).as(dbNames[x]),
]), ]),
]), ]) as {
[k in keyof typeof typeInfo.$inferInsert]-?: SQL.Aliased<
(typeof typeInfo.$inferInsert)[k]
>;
},
) )
.from( .from(
sql`unnest(${sql.join( sql`unnest(${sql.join(