Type error after upgrading from 1.18 to 1.26
Hi, I have a type that was working fine until I upgraded convex to the latest, any suggestion on what I should update my type to?
error:
export type EventsArray = NonNullable<Awaited<ReturnType<typeof getByGroup>>>;export type EventsArray = NonNullable<Awaited<ReturnType<typeof getByGroup>>>;error:
Type error: Type 'RegisteredQuery<"public", { groupId: Id<"groups">; }, Promise<{ attendees: { _id: Id<"users">; username: string; avatarUrl: string | undefined; }[]; category: { _id: Id<"categories">; name: string; }; ... 9 more ...; endDate: string; }[]>>' does not satisfy the constraint '(...args: any) => any'.
Type 'RegisteredQuery<"public", { groupId: Id<"groups">; }, Promise<{ attendees: { _id: Id<"users">; username: string; avatarUrl: string | undefined; }[]; category: { _id: Id<"categories">; name: string; }; ... 9 more ...; endDate: string; }[]>>' provides no match for the signature '(...args: any): any'.Type error: Type 'RegisteredQuery<"public", { groupId: Id<"groups">; }, Promise<{ attendees: { _id: Id<"users">; username: string; avatarUrl: string | undefined; }[]; category: { _id: Id<"categories">; name: string; }; ... 9 more ...; endDate: string; }[]>>' does not satisfy the constraint '(...args: any) => any'.
Type 'RegisteredQuery<"public", { groupId: Id<"groups">; }, Promise<{ attendees: { _id: Id<"users">; username: string; avatarUrl: string | undefined; }[]; category: { _id: Id<"categories">; name: string; }; ... 9 more ...; endDate: string; }[]>>' provides no match for the signature '(...args: any): any'.getByGroupgetByGroup is defined like thisexport const getByGroup = query({
args: { groupId: v.id("groups") },
handler: async (ctx, { groupId }) => {
const items = await ctx.db
.query("events")
.filter((q) => q.eq(q.field("group"), groupId))
.collect();
// for each item, get the user record for attendees and the category
return await Promise.all(
items.map(async (item) => {
const attendees = await Promise.all(
item.attendees.map(async (attendee) => {
const user = await ctx.db.get(attendee);
return {
_id: user!._id,
username: user!.username,
avatarUrl: user!.avatarUrl,
};
})
);
const category = item.category
? await ctx.db.get(item.category)
: undefined;
return {
...item,
attendees,
category: {
_id: category!._id,
name: category!.name,
},
};
})
);
},
});export const getByGroup = query({
args: { groupId: v.id("groups") },
handler: async (ctx, { groupId }) => {
const items = await ctx.db
.query("events")
.filter((q) => q.eq(q.field("group"), groupId))
.collect();
// for each item, get the user record for attendees and the category
return await Promise.all(
items.map(async (item) => {
const attendees = await Promise.all(
item.attendees.map(async (attendee) => {
const user = await ctx.db.get(attendee);
return {
_id: user!._id,
username: user!.username,
avatarUrl: user!.avatarUrl,
};
})
);
const category = item.category
? await ctx.db.get(item.category)
: undefined;
return {
...item,
attendees,
category: {
_id: category!._id,
name: category!.name,
},
};
})
);
},
});