Replies: 2 comments
-
type TableWithCursor = AnyTable & { user: any, cursorId: any } It's not perfect but it's very simple. |
Beta Was this translation helpful? Give feedback.
-
Turns out both solutions drop the type information. I settled on this for now-- const getPagedResult = async <
and everything's working fine with caveats-- 1) whenever calling this function with a new table it has to be added to the extends defintion and 2) typescript's compiler isn't able to infer that items is of type T["$inferSelect"][], so it needs the ts-ignore statement to be happy. |
Beta Was this translation helpful? Give feedback.
-
Assume you have some tables with similar properties-- for instance this one, where multiple tables have cursors.
The following code... works... But is there a more ergonomic way I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions