signavio / react-mentions

@mention people in a textarea
https://react-mentions.vercel.app
Other
2.4k stars 560 forks source link

not detect the data param on <Mention> #735

Open ksei9305 opened 4 months ago

ksei9305 commented 4 months ago

Steps to reproduce:

  1. npm i react-mentions
  2. write the code
    const userMentions = users ? users.map((user) => ({ id: user.id, display: user.name })) : [];
    <MentionsInput value={''} onChange={() => {}}>
            <Mention trigger="@" data={userMentions} renderSuggestion={userMentions} />
          </MentionsInput>
  3. error occurred like this

TS2322: Type '{ trigger: string; data: { id: string; display: string; }[]; renderSuggestion: { id: string; display: string; }[]; }' is not assignable to type 'IntrinsicAttributes & Pick<InferProps<{ onAdd: any; onRemove: any; renderSuggestion: any; trigger: any; markup: any; displayTransform: any; allowSpaceInQuery: any; isLoading: any; }>, "allowSpaceInQuery"> & InexactPartial<...> & InexactPartial<...>'. Property 'data' does not exist on type 'IntrinsicAttributes & Pick<InferProps<{ onAdd: any; onRemove: any; renderSuggestion: any; trigger: any; markup: any; displayTransform: any; allowSpaceInQuery: any; isLoading: any; }>, "allowSpaceInQuery"> & InexactPartial<...> & InexactPartial<...>'. 139 | {//>/} 140 | <MentionsInput value={''} onChange={() => {}}>

141 | | ^^^^ 142 | 143 | 144 |

Workaround: "react-mentions": "^4.4.10",