I've been trying to wrap a component SelectSearchResult
around AsyncSelect
from react-select
. I'd like that the props of my custom component to be almost the same of AsyncSelect
with some exceptions.
import AsyncSelect, { Props as AsyncSelectProps } from "react-select/async";
// works, but Props allows all properties
type Props = AsyncSelectProps<{ label: string; value: string }>;
const SelectSearchResult = (props: Props) => {
return <AsyncSelect {...props} />;
};
I assumed I just needed to omit the keys I didn't want.
type Props = Omit<AsyncSelectProps<{ label: string; value: string }>, "loadOptions">;
However, when I inspect Props
, it has now the following format and I am clueless of why is it taking this shape from.
type Props = {
[x: string]: any;
[x: number]: any;
}