Is it possible to generate types for select input/radio group values?

We have fields where the field editor type is set to either “select input” or “radio group” (or where the visual select plugin is used – though for this discussion, let’s focus on DatoCMS’s core functionality :slight_smile:).

Is it possible to generate a type that includes all the possible values defined for such a field?

I don’t believe so, sorry :frowning: The typedefs are usually generated from your schema, not your values. But you can use the CMA to pull the validation rules for that field (the enum validator at https://www.datocms.com/docs/content-management-api/resources/field#validators) and then write a script to generate a typedef from it?

1 Like