I'm working on the UI Kitten component called Autocomplete.
I've followed their Documentation, but since it's in React and not typescript, and I'm quite new on typescript, I always get the same error of "Parameter 'item' implicitly has an 'any' type."
The code i have is the following:
export const HSCodes = [ { description: 'A RANDOM NAME', HSCode: 'A RANDOM CODE' }, ... many more ]; function filterItem(item, query: string) { if (item.description.includes(query.toUpperCase())) { return item.description.includes(query.toUpperCase()); } else if (item.HSCode.includes(query.toUpperCase())) { return item.HSCode.includes(query.toUpperCase()); } } const onSelectHS = (index: number) => { setHsCode(HSCodes[index].HSCode); }; const onChangeTextHS = (query: string) => { setHsCode(query); setDataHS(HSCodes.filter((item: object) => filterItem(item, query))); }; const renderOptionHS = (item, index: number) => (<AutocompleteItem key={index} title={item.description +''+ item.HSCode} /> );... things not important<Autocomplete placeholder={t('Enter DUA Number') value={hsCode} style={styles.autoComplete} onSelect={onSelectHS} onChangeText={onChangeTextHS} onBlur={saveHsCode}> {dataHS.map(renderOptionHS)}</Autocomplete>
I'm struggling because if I declare item: object, it all breaks down, what it actually says when I declare item as object for example in the filterItem
Property 'description' does not exist on type 'object'.