Skip to content

Commit

Permalink
fix(fields): handle missing boolean option value case in options fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Feb 27, 2024
1 parent 32bf182 commit 4e0036f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/getRsuiteDataItemValueFromOptionValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function getRsuiteDataItemValueFromOptionValue<OptionValue extends Option
throw new Error(
[
`You must provide a valid option value key when using objects as option values.`,
`The property value must exist and be a unique number or a string.`,
`OptionValue: \`${JSON.stringify(optionValue)}\`.`,
`OptionValueKey: \`${String(optionValueKey)}\`.`
].join(' ')
Expand All @@ -21,7 +22,7 @@ export function getRsuiteDataItemValueFromOptionValue<OptionValue extends Option
return String(optionValue[optionValueKey])
}

if (typeof optionValue !== 'number' && typeof optionValue !== 'string') {
if (typeof optionValue !== 'boolean' && typeof optionValue !== 'number' && typeof optionValue !== 'string') {
throw new Error(
[
`You must provide an option value key when using objects as option values.`,
Expand Down

0 comments on commit 4e0036f

Please sign in to comment.