Move fromItemToOutRow to table instance it self
Opened this issue · 2 comments
phiresky commented
I want to be able to do
export const tbl = s.table("tbl", { test: tInteger });
type Tbl = typeof tbl.$rowInstance;
// instead of
type Tbl = FromItemToOutRow<typeof tbl>;
(or similar)
hediet commented
$rowInstance
would be a useless (i.e. unused) field. What is the advantage of typeof tbl.$rowInstance;
over FromItemToOutRow<typeof tbl>
?
phiresky commented
Say I have imported from
, myTable
, db
from somewhere and write a function like this:
async function getSomething() {
return await db.exec(from(myTable).select(myTable.$all));
}
async function doSomething(myTableInstance: typeof myTable.$rowInstance) {
...
}
i.e. I have imported the table definition, but not FromItemToOutRow. Now i could just specify the argument type for doSomething
using typeof myTable.$rowInstance
instead of having to add more imports or declaring that type somewhere else and importing it.