base / base/docs

TS error: params incorrectly

Open
#1,109 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
337
Forks
792
Avg merge
17h 23m
Merged PRs (30d)
49

Description

The [**Generate Dynamic Embed Images**](https://github.com/base/docs/blob/master/docs/mini-apps/technical-guides/dynamic-embeds.mdx) 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:

```tsx
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**](https://github.com/base/docs/pull/1108)
The PR updates all affected examples to the correct typing and removes `await` params.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.