Skip to content

TS error: params incorrectly #1109

@evshank

Description

@evshank

The Generate Dynamic Embed Images guide in the Base documentation contains an incorrect TypeScript typing for params in Next.js App Router examples.

Currently, the documentation types params as a Promise<{ username: string }> and accesses it using:

const { username } = await params;

However, in Next.js App Router:

  • params is always a synchronous object
  • is not a Promise
  • its type is { username: string }

Using the code in the current example results in an error:
TS2741: Property ‘username’ is missing in type ‘Promise<{ username: string; }>’ but required in type '{ username: string; }'

After the correction, the code compiles without errors.

This issue has been addressed in PR#1108
The PR updates all affected examples to the correct typing and removes await params.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions