Next.js Discord

Discord Forum

[Error] Failed to compile, while working with slugs and App Directory.

Answered
Porcelaine posted this in #help-forum
Open in Discord
PorcelaineOP
- info Creating an optimized production build
- info Compiled successfully
- info Linting and checking validity of types ..Failed to compile.


 .next/types/app/practice/[slug]/page.ts:8:13
Type error: Type 'OmitWithTag<typeof import("H:/jscodelab/jscodelab/app/practice/[slug]/page"), "metadata" | "default" | "config" | "generateStaticParams" | "revalidate" | "dynamic" | "dynamicParams" | "fetchCache" | "preferredRegion" | "runtime" | "maxDuration" | "generateMetadata", "">' does not satisfy the constraint '{ [x: string]: never; }'.
  Property 'getData' is incompatible with index signature.   
    Type '(slug: string) => Dirent[]' 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
error Command failed with exit code 1.
Answered by Porcelaine
Hey it got solved by removing unecesssary exports.
View full answer

2 Replies

Spectacled bear
Try x extends string instead of x:string
PorcelaineOP
Hey it got solved by removing unecesssary exports.
Answer