Extract OrderBy TS Keys

Dddanielcruzz5/18/2023
Hey I have the following query

const getBaseQuery = ({ offset, pageSize, slug }: GetBaseQuery) =>
  db
    .selectFrom((eb) =>
      eb
        .selectFrom(...)
        .innerJoin(...)
        .where(...)
        .select([
          ...
        ])
        .as(...)
    )
    .select([
      ...
    ])
    .offset(offset)
    .limit(pageSize);


And I'm trying to create a function that accepts that query and adds and orderBy expression based in some conditions

type BaseQuery = ReturnType<typeof getBaseQuery>;

type AddOrderBy = {
  query: BaseQuery;
  key?: 'what do I put here';
  dir?: "asc" | "desc";
};

const addOrderBy = ({ query, key, dir }: AddOrderBy) => {
  ...
};


How can I get the accepted key value types so I can put them in my type declaration?
Dddanielcruzz5/22/2023
@Igal sorry for the ping 😅 I think this might had lost between other posts