当使用文件结构 app -> explore -> page.tsx 并使用以下代码获取搜索参数时:
export default function ExplorePage({ searchParams }: { searchParams: { search: string | undefined } }) {
const { search } = searchParams
Run Code Online (Sandbox Code Playgroud)
我无法运行 npm run build。它给出了这个错误:
Type error: Page "app/explore/page.tsx" does not match the required types of a Next.js Page.
Invalid configuration:
The exported page component isn't correctly typed.
Expected "{ searchParams: { search: any; }; }", got "PageProps".
Invalid configuration:
Expected "{ search: any; }", got "Record<string, string | string[]> | undefined". …Run Code Online (Sandbox Code Playgroud)