Unverified Commit d72134ad authored by kyktommy's avatar kyktommy Committed by GitHub

Fix docs for generateMetadata typescript error (#71844)

### What?

Nextjs 15 changed generateMetadata params type. It will cause build
error when follow the docs.
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 95a48c59
...@@ -82,8 +82,8 @@ Dynamic metadata depends on **dynamic information**, such as the current route p ...@@ -82,8 +82,8 @@ Dynamic metadata depends on **dynamic information**, such as the current route p
import type { Metadata, ResolvingMetadata } from 'next' import type { Metadata, ResolvingMetadata } from 'next'
type Props = { type Props = {
params: { id: string } params: Promise<{ id: string }>
searchParams: { [key: string]: string | string[] | undefined } searchParams: Promise<{ [key: string]: string | string[] | undefined }>
} }
export async function generateMetadata( export async function generateMetadata(
...@@ -1155,8 +1155,8 @@ export async function generateMetadata(): Promise<Metadata> { ...@@ -1155,8 +1155,8 @@ export async function generateMetadata(): Promise<Metadata> {
import type { Metadata } from 'next' import type { Metadata } from 'next'
type Props = { type Props = {
params: { id: string } params: Promise<{ id: string }>
searchParams: { [key: string]: string | string[] | undefined } searchParams: Promise<{ [key: string]: string | string[] | undefined }>
} }
export function generateMetadata({ params, searchParams }: Props): Metadata { export function generateMetadata({ params, searchParams }: Props): Metadata {
......
...@@ -207,8 +207,8 @@ export function generateViewport(): Viewport { ...@@ -207,8 +207,8 @@ export function generateViewport(): Viewport {
import type { Viewport } from 'next' import type { Viewport } from 'next'
type Props = { type Props = {
params: { id: string } params: Promise<{ id: string }>
searchParams: { [key: string]: string | string[] | undefined } searchParams: Promise<{ [key: string]: string | string[] | undefined }>
} }
export function generateViewport({ params, searchParams }: Props): Viewport { export function generateViewport({ params, searchParams }: Props): Viewport {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment