-
Notifications
You must be signed in to change notification settings - Fork 732
Closed
Labels
Description
Puck does not allow optional values in select fields.
Steps to reproduce
Add an optional value with a select field
Code example
type Props = {
MyComponent: {
fruit?: 'apple' | 'banana' // Make optional with `?`
}
}
const conf: Config<Props> = {
components: {
MyComponent: {
fields: {
fruit: {
type: "select",
options: [
{ label: '', value: undefined }, // Should work because `fruit` is optional
{ label: 'Apple', value: 'apple' },
{ label: 'Banana', value: 'banana' },
]
}
}
}
}
}
What happened
TS complains that undefined is not a valid value for fruit
What I expected to happen
TS would not complain because fruit is optional in the Props type.
Seolhun