From 503404a2a9bdd443111b99c7176344f7cb33a789 Mon Sep 17 00:00:00 2001 From: kapilpipaliya Date: Mon, 26 Sep 2022 16:56:42 +0530 Subject: [PATCH] Fix Error When Options Value is Array I am getting this error when I have option value is array: `Uncaught Error: Incompatible value type for single select.` --- src/create-select.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/create-select.tsx b/src/create-select.tsx index 27b89f2..bea9592 100644 --- a/src/create-select.tsx +++ b/src/create-select.tsx @@ -40,7 +40,7 @@ const createSelect = (props: CreateSelectProps) => { const parseValue = (value: Value) => { if (config.multiple && Array.isArray(value)) { return value; - } else if (!config.multiple && !Array.isArray(value)) { + } else if (!config.multiple) { return value !== null ? [value] : []; } else { throw new Error( @@ -362,4 +362,4 @@ const createSelect = (props: CreateSelectProps) => { }; export { createSelect }; -export type { CreateSelectProps, SingleValue, Value, Option }; \ No newline at end of file +export type { CreateSelectProps, SingleValue, Value, Option };