fix: added typings for react-autosuggest (#200)

This commit is contained in:
Thomas Klein
2019-10-15 07:36:35 +02:00
committed by Juan Picado @jotadeveloper
parent 245247cbed
commit cfb29ce325
4 changed files with 21 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
import React, { KeyboardEvent } from 'react';
import { css } from 'emotion';
import Autosuggest from 'react-autosuggest';
import Autosuggest, { SuggestionSelectedEventData, InputProps, ChangeEvent } from 'react-autosuggest';
import match from 'autosuggest-highlight/match';
import parse from 'autosuggest-highlight/parse';
import MenuItem from '@material-ui/core/MenuItem';
@@ -20,12 +20,12 @@ interface Props {
placeholder?: string;
startAdornment?: JSX.Element;
disableUnderline?: boolean;
onChange?: (event: KeyboardEvent<HTMLInputElement>, { newValue, method }: { newValue: string; method: string }) => void;
onSuggestionsFetch?: ({ value: string }) => Promise<void>;
onChange: (event: React.FormEvent<HTMLInputElement>, params: ChangeEvent) => void;
onSuggestionsFetch: ({ value: string }) => Promise<void>;
onCleanSuggestions?: () => void;
onClick?: (event: KeyboardEvent<HTMLInputElement>, { suggestionValue, method }: { suggestionValue: string[]; method: string }) => void;
onClick?: (event: React.FormEvent<HTMLInputElement>, data: SuggestionSelectedEventData<unknown>) => void;
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
onBlur?: (event: KeyboardEvent<HTMLInputElement>) => void;
onBlur?: (event: React.FormEvent<HTMLInputElement>) => void;
}
/* eslint-disable react/jsx-sort-props */
@@ -113,7 +113,7 @@ const AutoComplete = ({
onSuggestionsFetchRequested: onSuggestionsFetch,
onSuggestionsClearRequested: onCleanSuggestions,
};
const inputProps = {
const inputProps: InputProps<unknown> = {
value,
onChange,
placeholder,