Skip to content

Commit

Permalink
fix: extends type all to the locale type definition in req (#10399)
Browse files Browse the repository at this point in the history
### What?

If you query with all locales using the `'all'` value for locales, the
`req.locale` value is `'all'` but the type definition only contains the
available locales.

### Why?

The `CustomPayloadRequestProperties.locale` property was only being
typed as `TypedLocale` and was not extending `'all'.`

### How?

Extends type all to the locale type definition in req

Fixes #10244
  • Loading branch information
PatrikKozak authored Jan 6, 2025
1 parent f629709 commit eadce5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/payload/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export type CustomPayloadRequestProperties = {
/**
* The requested locale if specified
* Only available for localized collections
*
* Suppressing warning below as it is a valid use case - won't be an issue if generated types exist
*/
locale?: TypedLocale
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
locale?: 'all' | TypedLocale
/**
* The payload object
*/
Expand Down

0 comments on commit eadce5e

Please sign in to comment.