sqliteTable wrapper which modifies fields, with proper types

Ttacomanator4/12/2023
More of a TypeScript question, but I'm trying to create a wrapper for sqliteTable to add a set of standard fields (and keys) to the fields provided:

import { sqliteTable, SQLiteTableFn } from "drizzle-orm/sqlite-core"

const extraFields = { ... }

const wrapper: SQLiteTableFn = (name, fields, keys) => {
  return sqliteTable(
    name,
    { ...extraFields, ...fields },
    (Table) => ({ ...keys })
  );
};


This results in a type error on wrapper as the generics applied to SQLiteTableFn and the return value of wrapper return value sqliteTable on modified fields) no longer correspond. How can I create a type for wrapper which returns object properly typed?
UUUnknown User4/12/2023
Message Not Public
Sign In & Join Server To View
Ttacomanator4/13/2023
I was doing something like that previously, but my goal is to create a function which returns two tables: one with the fields as is, and a second table with extra fields added. The part I am struggling with is the return type of table2, which is intended to be the modified version of the second table.

const [table1, table2] = wrapper("name", { {/* fields */} })