generate:types - precise type-gen based on other args & support locale:all typings #6787
Replies: 2 comments
-
The interface is correct. You can't receive all locales at once. You need to specify which locale you want to fetch via the locale query parameter. Otherwise the fallback language will get used. |
Beta Was this translation helpful? Give feedback.
-
As of now the types output works as expected. You will only ever see the Instead, we could have 2 separate types - one with the full locale object, one without it. Depending on whether We should do the same thing for depth & relationships, where relationships would be strings for depth: 0 and objects for higher depths. This however is a feature request for improving our type generation, not necessarily an issue with our current type gen, which is why I have converted this into a discussion. Our current type gen is set up to only output a single type per field, and this would already be the optimal to do it given the constraints |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Link to reproduction
No response
Describe the Bug
When using localisation, fields have the following structure:
However, when using
npx payload generate:types
we still get an interface for non localised content. E.g. the following collection:will get inferred the following interface:
which is incorrect, the correct interface would be something like this:
inferring
locale_1
andlocale_2
from thepayload.config.ts
To Reproduce
Create a Collection with localisation and try to get its type with
payload generate:types
Payload Version
2.8.2
Adapters and Plugins
db-mongodb, bundler-webpack, richtext-slate, plugin-cloud-storage
Beta Was this translation helpful? Give feedback.
All reactions