Skip to content

[QUESTION] How do I type the data such that renderItem is of custom type? #136

@downright-development

Description

@downright-development

Currently my logic is..

renderItem={(item, text) => (

{item.title} - {item.category} - ({item.availableQuantity}{" "}
available)

)}

This works just fine! However, category and available quantity don't pass Typescript sniffs because item is of type AutocompleteDropdownItem.

I tried this as the model for the dataSet I'm passing, but no dice.

interface AutocompleteInventoryMeta extends AutocompleteDropdownItem {
id: string;
title: string;
category: string;
availableQuantity: number;
unit: string;
pictureUrl: string;
}

How can I fix my renderItem such that it correctly understands the type?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions