You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Autocomplete,AutocompleteItem,AutocompleteSection}from"@nextui-org/react";import{useState}from"react";constdata=[{id: 1,name: "Cat 1",cats: [{id: 1,name: "Cat 1.1",},{id: 2,name: "Cat 1.2",}]},{id: 2,name: "Cat 2",cats: [{id: 3,name: "Cat 2.1",},{id: 4,name: "Cat 2.2",}]}];functionApp(){const[category,setCategory]=useState<number>();return(<divclassName="flex"><Autocompletelabel="Categories"placeholder="Search categories..."value={category}onChange={(e)=>setCategory(Number(e.target.value))}className="max-w-xs"defaultItems={data}>{(c)=><AutocompleteSectionkey={`c${c.id}`}title={c.name}items={c.cats}>{/* get "Did you mean to call this expression?" in the below line" */}{(i)=><AutocompleteItemkey={`sc${i.id}`}value={i.id}>{i.name}</AutocompleteItem>}</AutocompleteSection>}</Autocomplete></div>)}exportdefaultApp
VS Code complains as follows:
Type '(i: { id: number; name: string; }) => Element' is not assignable to type '(ItemElement<{ id: number; name: string; }> | ItemElement<{ id: number; name: string; }>[] | ItemRenderer<{ id: number; name: string; }>) & ReactNode'.
Type '(i: { id: number; name: string; }) => Element' is not assignable to type 'ItemRenderer<{ id: number; name: string; }> & string'.
Type '(i: { id: number; name: string; }) => Element' is not assignable to type 'string'.ts(2322)
App.tsx(42, 12): Did you mean to call this expression?
Kindly note I able to run the application just fine and able to see the expected output / functionality in the browser.
This seems to be the case whenever we try to use dynamic elements under sectional components: AutocompleteSection, ListboxSection etc as given in the sample (ref: #2505 ).
Confirming the issue persists in nextui version 2.2.10
Only workaround seems to be to use arraymap instead of collection components api.
NextUI Version
2.2.9
Describe the bug
Hello team,
Getting same issue as #1503 but with
Autocomplete
VS Code complains as follows:
Kindly note I able to run the application just fine and able to see the expected output / functionality in the browser.
Context:
Sample repository: https://github.com/vijayganeshpk/bug-nextui-automplete-autocompletesection
Your Example Website or App
https://github.com/vijayganeshpk/bug-nextui-automplete-autocompletesection
Steps to Reproduce the Bug or Issue
Type '(i: { id: number; name: string; }) => Element' is not assignable to type 'string'.
andDid you mean to call this expression?
Expected behavior
As a user, I expected the code does not make the IDE to show any issues, but it does.
Screenshots or Videos
No response
Operating System Version
Windows
Browser
Chrome
The text was updated successfully, but these errors were encountered: