Remove generic qualifiers (used for testing)

This commit is contained in:
CuriousCorrelation authored and Tom Moor committed 2022-07-17 12:22:25 +01:00
1 parent 7a57d8fbf9
commit 5544521524
1 file changed
+8 -7
+8 -7
View File
@@ -9,14 +9,15 @@ import { Outline } from "./Input";
import InputSearch from "./InputSearch";
import PaginatedList, { PaginatedItem } from "./PaginatedList";
type TFilterOption = PaginatedItem & {
type TFilterOption = {
id: string;
key: string;
label: string;
note?: string;
};
type Props<T> = {
options: T[];
type Props = {
options: TFilterOption[];
activeKey: string | null | undefined;
defaultLabel?: string;
selectedPrefix?: string;
@@ -25,10 +26,10 @@ type Props<T> = {
searchable?: boolean;
paginateFetch?: (
options: PaginatedItem
) => Promise<PaginatedItem[] | undefined>;
) => Promise<TFilterOption[] | undefined>;
};
const FilterOptions = <T extends TFilterOption>({
const FilterOptions = ({
options,
activeKey = "",
defaultLabel = "Filter options",
@@ -37,11 +38,11 @@ const FilterOptions = <T extends TFilterOption>({
onSelect,
searchable,
paginateFetch,
}: Props<T>) => {
}: Props) => {
const menu = useMenuState({
modal: true,
});
const [filteredData, setFilteredData] = React.useState<T[]>([]);
const [filteredData, setFilteredData] = React.useState<TFilterOption[]>([]);
const selected =
options.find((option) => option.key === activeKey) || options[0];