Pedram
Pedram
CCConvex Community
Created by Pedram on 11/22/2024 in #support-community
Type error on internal query
Hey there. Beginner developer here, hoping to get help with the following type error on line 3. I don't understand why TypeScript thinks the return type is self-referential.
handler implicitly has return type any because it does not have a return type annotation and is referenced directly or indirectly in one of its expressions. ts(7023)
// openAi.ts
export const getToken = internalQuery({
handler: async (ctx, _) => await ctx.runQuery(internal.secrets.get, {key: 'openAiKey'})
})

// secrets.ts
export const get = internalQuery({
args: {key: v.string()},
handler: async (ctx, _) => await ctx.db.query('secrets').filter(q => q.eq('key', args.key)).unique()
})
// openAi.ts
export const getToken = internalQuery({
handler: async (ctx, _) => await ctx.runQuery(internal.secrets.get, {key: 'openAiKey'})
})

// secrets.ts
export const get = internalQuery({
args: {key: v.string()},
handler: async (ctx, _) => await ctx.db.query('secrets').filter(q => q.eq('key', args.key)).unique()
})
9 replies