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;
}
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;
}
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?