Skip to content

Commit 1be8b11

Browse files
authored
Fix type checking of picker options (#774)
1 parent 542b7a9 commit 1be8b11

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/src/components/Picker/PickerCommon.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,18 @@ export function normalizeToPickerOptions(
5959

6060
const firstOption = options[0];
6161

62-
if (typeof firstOption === ("string" || "number")) {
62+
if (typeof firstOption === "string" || typeof firstOption === "number") {
6363
return options.map((option) => ({
6464
label: option as string | number,
6565
value: option as string | number,
6666
}));
6767
}
6868

69-
if (isObject(firstOption) && firstOption.value && firstOption.label) {
69+
if (
70+
isObject(firstOption) &&
71+
firstOption.value !== undefined &&
72+
firstOption.label !== undefined
73+
) {
7074
return (options as PickerOption[]).map((option) => {
7175
return {
7276
label: option.label,

0 commit comments

Comments
 (0)