getTableColumns() for `with`?

Hi, is there any alternative to getTableColumns() for with CTEs?

If I use the example from the docs:

const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));
const result = await db.with(sq).select().from(sq);


How would I get the columns of sq? Calling getTableColumns(sq) does not work.

It looks like sq._.selectedFields works as an alternative, but is that the right way?
Was this page helpful?