Nishil Faldu
Nishil Faldu7mo ago

Is there an easier way to write an

Is there an easier way to write an OrderedQuery type? I think I managed everything else except the fieldPaths parameter but its messy lol
1 Reply
Nishil Faldu
Nishil FalduOP7mo ago
let orderedQuery:
OrderedQuery<{document: Doc<"listings">, fieldPaths: "description",
indexes: { bySellerId: ["sellerId", "_creationTime"]; byCategoryId: ["categoryId", "_creationTime"]; by_id: ["_id"]; by_creation_time: ["_creationTime"]; },
searchIndexes: {}, vectorIndexes: {}}>;
let orderedQuery:
OrderedQuery<{document: Doc<"listings">, fieldPaths: "description",
indexes: { bySellerId: ["sellerId", "_creationTime"]; byCategoryId: ["categoryId", "_creationTime"]; by_id: ["_id"]; by_creation_time: ["_creationTime"]; },
searchIndexes: {}, vectorIndexes: {}}>;
here fieldPaths is wrong and I can't figure out why for anyone who needs it in the future I did this: let orderedQuery: ReturnType<typeof listingsQuery.order>; I feel like such a solution can be used anywhere lol, kinda feels like cheating but its just a great feature

Did you find this page helpful?