export const getWorlds = query({
args: {},
handler: async (ctx, args) => {
const userId = await getAuthUserId(ctx);
if (userId === null) {
return { worlds: [] };
}
const profile = await ctx.runQuery(internal.functions.getProfile, {
userId: userId,
});
if (profile === null) {
return { worlds: [] };
}
const profileId = profile._id;
const worlds = await ctx.db.query("worlds").collect();
const final = worlds.filter((world) =>
world.participants.includes(profileId),
);
// return {
// worlds: final,
// };
},
});
this works (commented out). if the last line is not commented out, i get
'final' is declared but its value is never read.ts(6133)
⌘+click to open in new tab
'final' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
⌘+click to open in new tab
const final: any
what is going on?