Extract type from SubQuery

If I have a query like this I intend to use as a subquery:

const foo = db.select({
    id: fooTable.id,
    name: fooTable.name,
    enabled: fooTable.enabled,
}).from(fooTable).as('foo');


Is there any way I can extract a type from this, such like:

type Foo = {
    id: number;
    name: string;
    enabled: boolean;
}
Was this page helpful?