Next.js Discord

Discord Forum

Error while building project

Unanswered
gref9730 posted this in #help-forum
Open in Discord
Hello I created next js project in typescript and when I try to build it im getting errors which I have no clue why its happening ...

 ✓ Compiled successfully
   Linting and checking validity of types  ...Failed to compile.

.next/types/app/(title)/prodInfos/page.ts:28:13
Type error: Type 'OmitWithTag<{ children: ReactNode; }, keyof PageProps, "default">' does not satisfy the constraint '{ [x: string]: never; }'.
  Property 'children' is incompatible with index signature.
    Type 'ReactNode' is not assignable to type 'never'.
      Type 'string' is not assignable to type 'never'.

  26 |
  27 | // Check the prop type of the entry function
> 28 | checkFields<Diff<PageProps, FirstArg<TEntry['default']>, 'default'>>()
     |             ^
  29 |
  30 | // Check the arguments and return type of the generateMetadata function
  31 | if ('generateMetadata' in entry) {



I have

- layout.tsx
-page.tsx
|- [id]
|-page.tsx

im both in layout.tsx and page.tsx and in the inner page.tsx prop drilling children ...as like so

({
  children,
}: {
  children: React.ReactNode; 
})

2 Replies

are you exporting anything beside the main component? I think in page.tsx only certain things can be exported
or importing the page somewhere else as component?
usually one of those 2 things give that error