Next.js Discord

Discord Forum

Property 'useGetImageData' is incompatible with index signature.

Answered
Sw1ndler posted this in #help-forum
Open in Discord
Attempting to build the code in the image results in this error.
Answered by joulev
Do not export that useGetImageData function
View full answer

6 Replies

The code runs fine in dev mode, it only errors on build
Type error: Type 'OmitWithTag<typeof import("C:/Users/lisin/Documents/Coding/React/lemon-host/src/app/dashboard/(dashboard-routes)/uploads/page"), "default" | "config" | "generateStaticParams" | "revalidate" | ... 9 more ... | "generateViewport", "">' does not satisfy the constraint '{ [x: string]: never; }'.
  Property 'useGetImageData' is incompatible with index signature.
    Type '(userData: UserData | null, sessionId: string | null, userId: string | null) => ImageData | null' is not assignable to type 'never'.

   6 |
   7 | // Check that the entry is a valid entry
>  8 | checkFields<Diff<{
     |             ^
   9 |   default: Function
  10 |   config?: {}
  11 |   generateStaticParams?: Function
@Sw1ndler The code runs fine in dev mode, it only errors on build
Do not export that useGetImageData function
Answer
You may only export certain things from page files and a function named that way is not allowed
Didnt know that