Skip to content

Commit

Permalink
Merge pull request #170 from Achintha444/main
Browse files Browse the repository at this point in the history
fix(react): fix autocomplete component prop type issue
  • Loading branch information
Achintha444 authored Oct 24, 2023
2 parents abc210d + 8115e4f commit 082cb47
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/react/src/components/Autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ export type AutocompleteProps<T> = MuiAutocompleteProps<T, boolean, boolean, boo

const COMPONENT_NAME: string = 'Autocomplete';

const Autocomplete: ForwardRefExoticComponent<AutocompleteProps<Record<string, unknown>>> & WithWrapperProps =
forwardRef(
(props: AutocompleteProps<Record<string, unknown>>, ref: MutableRefObject<HTMLDivElement>): ReactElement => {
const {className, ...rest} = props;
/**
* @remarks `any` is used as the generic type for the props because the generic type is not used in the component.
*/
const Autocomplete: ForwardRefExoticComponent<AutocompleteProps<any>> & WithWrapperProps = forwardRef(
(props: AutocompleteProps<any>, ref: MutableRefObject<HTMLDivElement>): ReactElement => {
const {className, ...rest} = props;

const classes: string = clsx('oxygen-autocomplete', className);
const classes: string = clsx('oxygen-autocomplete', className);

return <MuiAutocomplete className={classes} {...rest} ref={ref} />;
},
) as ForwardRefExoticComponent<AutocompleteProps<Record<string, unknown>>> & WithWrapperProps;
return <MuiAutocomplete className={classes} {...rest} ref={ref} />;
},
) as ForwardRefExoticComponent<AutocompleteProps<any>> & WithWrapperProps;

Autocomplete.displayName = composeComponentDisplayName(COMPONENT_NAME);
Autocomplete.muiName = COMPONENT_NAME;
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@

export {default} from './Autocomplete';
export type {AutocompleteProps} from './Autocomplete';
export type {AutocompleteRenderGetTagProps, AutocompleteRenderInputParams} from '@mui/material/Autocomplete';

0 comments on commit 082cb47

Please sign in to comment.