Multiselect: Errors on types and behaviour not as documented #4129
Labels
Type: Bug
Issue contains a defect related to a specific component.
Typescript
Issue or pull request is *only* related to TypeScript definition
Milestone
Describe the bug
Hey guys, how are you doing?
I'd like to report something that's going on with the MultiSelect component.
I'm currently at v8.7.3, but I'm afraid this persisted at the current version (v9.2.0).
As seen in the docs, we have a clear way to build a custom filter template.
filterOptions
is destructed from theoptions
argument which is typed asMultiSelectFilterOptions
.But there's no
filterOptions
declared in this interface.The
filter
function as seen above is typed asKeyboardEvent
, which may be a mistake as the current event type passed by theinput
at theonChange
event is typed asChangeEvent<HTMLInputElement>
, by default, and even at theInputText
component, used in the docs example.This one is just a type problem, because the current returned event is "correct".
But, besides the type problem, the
reset
function is not working properly.Above, we can see the error is at
props.resetFilter()
. I did some digging but I couldn't find anything that could explain why this is not working. I don't know if when using a customonFilter
, theresetFilter
function is not passed as prop.I'm afraid even the docs example would not work.
Reproducer
No response
PrimeReact version
8.7.3
React version
17.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
Chrome
Steps to reproduce the behavior
MultiSelect
component.filterTemplate
filterOptions
from thefilterTemplate
passed argument.filter
andreset
functions on custom inputs.Expected behavior
Types represeting the actual event structure and methods of
filter
andreset
working properly.The text was updated successfully, but these errors were encountered: