Next.js Discord

Discord Forum

Type error: Type '{ slug: string[]; }[]' is not assignable to type 'Promise<{ slug: string[]; }>[]'.

Unanswered
Silver Fox posted this in #help-forum
Open in Discord
Silver FoxOP
export async function generateStaticParams(): Promise<
  BlogPageItemProps["params"][]
> {
  return allBlogs.map((blog) => ({ // error here
    slug: blog.slugAsParams.split("/"),
  }));
}

2 Replies

Silver FoxOP
type BlogPageItemProps = {
  params: Promise<{
    slug: string[];
  }>;
}