react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

setFilters type definition issues.

Open martdavidson opened this issue 5 years ago • 0 comments

What you were expecting: Documentation shows using setFilters with only one parameter. For instance, from the List View docs:

const onSubmit = values => {
        if (Object.keys(values).length > 0) {
            setFilters(values);
        } else {
            hideFilter("main");
        }
    };

Type definition is:

setFilters: (
        filters: any,
        displayedFilters: any,
        debounce?: boolean
    ) => void;

Making the displayedFilters param required.

What happened instead: You're unable to use setFilters as shown in the documentation without passing displayedFilters. Not sure whether the type definition or the documentation is incorrect.

Steps to reproduce: Enable typescript, and call setFilters with a single parameter.

Environment

  • React-admin version: 3.10.3
  • React version: 17.0.1
  • Typescript Version: 4.1.2

Thanks for the great work on types though, really looking forward to having it all locked in.

martdavidson avatar Dec 07 '20 14:12 martdavidson