Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(with zones): params causes a failure to compile #72238

Open
wants to merge 4 commits into
base: canary
Choose a base branch
from

Conversation

Kaikaikaifang
Copy link

@Kaikaikaifang Kaikaikaifang commented Nov 3, 2024

Type '{ params: { id: any; }; }' does not satisfy the constraint 'PageProps'.

What?

Fix example: with zones bug

image

Why?

Uncompilable due to nextjs update

How?

Adapt to nextjs15:

await params

Type '{ params: { id: any; }; }' does not satisfy the constraint 'PageProps'.
@ijjk ijjk added the examples Issue/PR related to examples label Nov 3, 2024
@dominictracey
Copy link

I was just getting ready to do this. Thanks @Kaikaikaifang

@dominictracey
Copy link

Though I got slightly different code from npx @next/codemod@latest --force next-async-request-api ., which might be more appropriate.

type Params = {
  params: Promise<{
    slug: string;
  }>;
};

export async function generateMetadata(props: Params): Promise<Metadata> {
  const params = await props.params;

@Kaikaikaifang
Copy link
Author

Though I got slightly different code from npx @next/codemod@latest --force next-async-request-api ., which might be more appropriate.

type Params = {
  params: Promise<{
    slug: string;
  }>;
};

export async function generateMetadata(props: Params): Promise<Metadata> {
  const params = await props.params;

You are right.
I changed the code to keep it in sync with the documentation style

@Kaikaikaifang
Copy link
Author

@dominictracey

I noticed that the example with zones have not been updated and this PR is still going on, please reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants