dannyeloD
Convex Community16mo ago
43 replies
dannyelo

Type error: implicitly has type 'any' because it does not have a type annotation

Hello, I have a type error but can't figure it out why its causing it.

export const createInvoice = action({
  args: {
    orderId: v.id('orders'),
  },
  handler: async (ctx, args) => {
     // ... irrelevant code

    const order = await ctx.runQuery(internal.orders.getOrderByIdInternal, {
      orderId: args.orderId,
    })

    if (!order) {
      throw new Error('Order not found')
    }

    return order
  },
})


When I return the order, the variable order, createInvoice and handler turns red with a type error. (image attached).
'order' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)
'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 return expressions.ts(7023)
'createInvoice' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.ts(7022)


What am I doing wrong?
image.png
image.png
Was this page helpful?