Skip to content

Commit

Permalink
Restored types for select
Browse files Browse the repository at this point in the history
  • Loading branch information
Mil4n0r committed Dec 24, 2024
1 parent 22b4ae4 commit bcb9f90
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/lib/src/select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ const DxcSelect = forwardRef<RefType, SelectPropsType>(
const handleSelectChangeValue = (newOption: ListOptionType | undefined) => {
if (newOption) {
const currentValue = value ?? innerValue;
// TODO: Fix types
const newValue = multiple
? Array.isArray(currentValue) && currentValue.includes(newOption.value)
? currentValue.filter((optionVal: string) => optionVal !== newOption.value)
: [...currentValue, newOption.value]
? (currentValue as string[]).includes(newOption.value)
? (currentValue as string[]).filter((optionVal: string) => optionVal !== newOption.value)
: [...(currentValue as string[]), newOption.value]
: newOption.value;

if (value == null) {
Expand Down

0 comments on commit bcb9f90

Please sign in to comment.