Proper type for relational query

How can I generically type for the result of a relational query? Am I supposed to be able to use SQLiteRelationalQuery? I'm having trouble getting types to work if so.
interface RelationalQueryFn<?> {
(ids: string[]): SQLiteRelationalQuery<?>
}

function getData<Query extends SQLiteSelect, ?>(baseQuery: Query, relationalQueryFn: RelationalQueryFn<?>) {
const { rowCount, data } = await paginatedQuery(baseQuery);
const relatedData = await relatedQueryFn(data.map(({id}) => id))
// cominbe and return result
}
interface RelationalQueryFn<?> {
(ids: string[]): SQLiteRelationalQuery<?>
}

function getData<Query extends SQLiteSelect, ?>(baseQuery: Query, relationalQueryFn: RelationalQueryFn<?>) {
const { rowCount, data } = await paginatedQuery(baseQuery);
const relatedData = await relatedQueryFn(data.map(({id}) => id))
// cominbe and return result
}
Also curious about the type for a relational query itself, not wrapped in a function, and perhaps one using prepare(), but I'm using a function because sql.placeholder doesn't work with arrays. Also, am using the beta with relational queries V2.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?