Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/typescript/generating-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ payload generate:types

You can run this command whenever you need to regenerate your types, and then you can use these types in your Payload code directly.

### ⚠️ Note for Next.js users

In a default Next.js project (which does **not** include `"type": "module"` in `package.json`), you might encounter an error when running `payload generate:types`.

To fix this, add the following line to your `package.json`:

```json
{
"type": "module"
}
```

> 💡 This enables ECMAScript Modules (ESM) which are required for the type generation script to run correctly.

## Disable declare statement

By default, `generate:types` will add a `declare` statement to your types file, which automatically enables type inference within Payload.
Expand Down