Skip to content

Commit

Permalink
fix: resolve type error in select component Chakra styles
Browse files Browse the repository at this point in the history
fix: resolve type error in select component Chakra styles

- Updated utils.ts to explicitly cast `state.selectProps.size` to `Size | undefined` in `getValueContainerStyles` and `getSingleValueStyles`.
- Fixed TypeScript compatibility issues related to `SizeProp` and `Size` types.
- Ensured proper typing for Chakra styles in the select component.

This fix addresses TypeScript errors during `npx tsc --noEmit` and improves type safety.
  • Loading branch information
dwarkesh8 authored Jan 7, 2025
1 parent 20335b6 commit 42fb081
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/shared/forms/inputs/select/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ const getChakraStyles: (colorMode: ColorMode) => ChakraStylesConfig<Option> = (c
}),
valueContainer: (provided, state) => ({
...provided,
...getValueContainerStyles(state.selectProps.size),
...getValueContainerStyles(state.selectProps.size as Size | undefined), // Explicitly cast here
py: 0,
}),
singleValue: (provided, state) => ({
...provided,
mx: 0,
transform: 'none',
...getSingleValueStyles(state.selectProps.size),
...getSingleValueStyles(state.selectProps.size as Size | undefined), // Explicitly cast here
}),
};
};
Expand Down

0 comments on commit 42fb081

Please sign in to comment.