is there a nice way to say getTableColumns - but without columns id and foo?

Is there an easy way to omit columns?

This is what I came up with but...

export function withoutColumns<T extends Table>(columns: T['_']['columns'], excludedColumns: string[]): T['_']['columns'] {
  const r = Object.fromEntries(
    Object.entries(columns).filter(([key]) => !excludedColumns.includes(key))
  ) as T['_']['columns'];
  return r;
}
Was this page helpful?