From a3585cc7b252ff70fb016b57822559998157b58f Mon Sep 17 00:00:00 2001 From: Kevin Ghadyani Date: Mon, 17 Apr 2023 13:41:11 -0500 Subject: [PATCH] fix: export types for Autocomplete --- .../odyssey-react-mui/src/Autocomplete.tsx | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/odyssey-react-mui/src/Autocomplete.tsx b/packages/odyssey-react-mui/src/Autocomplete.tsx index fc1acf0849..84827ba2fe 100644 --- a/packages/odyssey-react-mui/src/Autocomplete.tsx +++ b/packages/odyssey-react-mui/src/Autocomplete.tsx @@ -19,24 +19,23 @@ import { memo, useCallback } from "react"; import { Field } from "./Field"; +declare module "react" { + // augment React types + function memo( + Component: (props: A) => B + ): (props: A) => ReactElement | null; + // return type is same as ReturnType> +} + export type AutocompleteProps = { isDisabled?: boolean; hint?: string; label: string; - onChange?: MuiAutocompleteProps; - options: OptionType[]; - value?: OptionType | null; + onChange?: MuiAutocompleteProps["onChange"]; + options: MuiAutocompleteProps["options"]; + value?: MuiAutocompleteProps["value"]; }; -// - const Autocomplete = ({ isDisabled, hint, @@ -50,7 +49,6 @@ const Autocomplete = ({ ( ({ return ( ({ ); }; -const MemoizedAutocomplete = memo(Autocomplete); +const MemoizedAutocomplete = memo(Autocomplete) as typeof Autocomplete; export { MemoizedAutocomplete as Autocomplete };