styleS
Convex Community4mo ago
3 replies
style

'getLogoUrl' implicitly has type 'any' because it does not have a type annotation and is referenced

When I use something like this (return internal query directly) then I get: 'getLogoUrl' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022) why is that? Shouldn't it infer type?


/**
 * Get a signed URL for the project's logo asset, if present
 */
export const getLogoUrl = query({
  args: { projectId: v.id('projects') },
  returns: v.union(v.string(), v.null()),
  handler: async (ctx, { projectId }) => {
    const context = await getCurrentProjectContext(ctx, projectId)
    if (!context.logoAsset) return null
    return await ctx.runQuery(internal.projects.projectContext._internalGetLogoUrl, { logoAsset: context.logoAsset })
  },
})

export const _internalGetLogoUrl = internalQuery({
  args: { logoAsset: v.id('_storage') },
  returns: v.union(v.string(), v.null()),
  handler: async (ctx, { logoAsset }) => {
    const url = await ctx.storage.getUrl(logoAsset)
    return url ?? null
  },
})
Was this page helpful?