From 374ca388d4a3d1583be2276686d1ad7e8e39eb8f Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Sun, 23 Oct 2022 10:48:20 -0700 Subject: [PATCH] Update params of PageProps to string map (#41677) x-ref: #41668 Update `PageProps` to `Record` Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com> --- .../build/webpack/plugins/flight-types-plugin.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/next/build/webpack/plugins/flight-types-plugin.ts b/packages/next/build/webpack/plugins/flight-types-plugin.ts index f16fcdcb939d0..55cb1cb4cb4a2 100644 --- a/packages/next/build/webpack/plugins/flight-types-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-types-plugin.ts @@ -25,8 +25,15 @@ type TEntry = typeof entry check(entry) -type PageProps = { params?: any } -type LayoutProps = { children: React.ReactNode; params?: any } +type PageParams = Record +interface PageProps { + params?: PageParams + searchParams?: Record +} +interface LayoutProps { + children: React.ReactNode + params?: PageParams +} type PageComponent = (props: PageProps) => React.ReactNode | null type LayoutComponent = (props: LayoutProps) => React.ReactNode | null @@ -39,7 +46,7 @@ interface IEntry { } config?: {} Head?: any - generateStaticParams?: (params?:any) => Promise + generateStaticParams?: (params?: PageParams) => Promise revalidate?: RevalidateRange | false dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static' dynamicParams?: boolean