diff --git a/types/react-instantsearch-core/index.d.ts b/types/react-instantsearch-core/index.d.ts index 551cae8621..9d73805005 100644 --- a/types/react-instantsearch-core/index.d.ts +++ b/types/react-instantsearch-core/index.d.ts @@ -38,7 +38,8 @@ interface ConnectorDescription { * This method should return the props to forward to the composed component. * props are the props that were provided to the higher-order component. * searchState holds the search state of all widgets. You can find the shape of all widgets search state in the corresponding guide. - * searchResults holds the search results, search errors and search loading state, with the shape {results: ?SearchResults, error: ?Error, searching: boolean, searchingForFacetValues: boolean}. The SearchResults type is described in the Helper’s documentation. + * searchResults holds the search results, search errors and search loading state, with the shape + * {results: ?SearchResults, error: ?Error, searching: boolean, searchingForFacetValues: boolean}. The SearchResults type is described in the Helper’s documentation. * meta is the list of metadata from all widgets whose connector defines a getMetadata method. * searchForFacetValuesResults holds the search for facet values results. */ @@ -46,28 +47,36 @@ interface ConnectorDescription { /** * This method defines exactly how the refine prop of widgets affects the search state. - * It takes in the current props of the higher-order component, the search state of all widgets, as well as all arguments passed to the refine and createURL props of stateful widgets, and returns a new state. + * It takes in the current props of the higher-order component, the search state of all widgets, as well as all arguments passed + * to the refine and createURL props of stateful widgets, and returns a new state. */ refine?(...args: any[]): any; /** - * This method applies the current props and state to the provided SearchParameters, and returns a new SearchParameters. The SearchParameters type is described in the Helper’s documentation. - * Every time the props or state of a widget change, all the getSearchParameters methods of all the registered widgets are called in a chain to produce a new SearchParameters. Then, if the output SearchParameters differs from the previous one, a new search is triggered. + * This method applies the current props and state to the provided SearchParameters, and returns a new SearchParameters. The SearchParameters + * type is described in the Helper’s documentation. + * Every time the props or state of a widget change, all the getSearchParameters methods of all the registered widgets are called in a chain + * to produce a new SearchParameters. Then, if the output SearchParameters differs from the previous one, a new search is triggered. * As such, the getSearchParameters method allows you to describe how the state and props of a widget should affect the search parameters. */ getSearchParameters?(...args: any[]): any; /** * This method allows the widget to register a custom metadata object for any props and state combination. - * If your widget is stateful, the corresponding URL key should be declared on the metadata object as the id property, so that the InstantSearch component can determine which URL keys it controls and which are foreign and should be left intact. - * The metadata object also allows you to declare any data that you would like to pass down to all other widgets. The list of metadata objects of all components is available as the fourth argument to the getProvidedProps method. - * The CurrentRefinements widget leverages this mechanism in order to allow any widget to declare the filters it has applied. If you want to add your own filter, declare a filters property on your widget’s metadata + * If your widget is stateful, the corresponding URL key should be declared on the metadata object as the id property, so that the InstantSearch + * component can determine which URL keys it controls and which are foreign and should be left intact. + * The metadata object also allows you to declare any data that you would like to pass down to all other widgets. The list of metadata objects of + * all components is available as the fourth argument to the getProvidedProps method. + * The CurrentRefinements widget leverages this mechanism in order to allow any widget to declare the filters it has applied. If you want to add + * your own filter, declare a filters property on your widget’s metadata */ getMetadata?(...args: any[]): any; /** * This method needs to be implemented if you want to have the ability to perform a search for facet values inside your widget. - * It takes in the current props of the higher-order component, the search state of all widgets, as well as all arguments passed to the searchForFacetValues props of stateful widgets, and returns an object of the shape: {facetName: string, query: string, maxFacetHits?: number}. The default value for the maxFacetHits is the one set by the API which is 10. + * It takes in the current props of the higher-order component, the search state of all widgets, as well as all arguments passed to the searchForFacetValues + * props of stateful widgets, and returns an object of the shape: {facetName: string, query: string, maxFacetHits?: number}. The default value for the + * maxFacetHits is the one set by the API which is 10. */ searchForFacetValues?(...args: any[]): any; @@ -75,7 +84,8 @@ interface ConnectorDescription { * This method is called when a widget is about to unmount in order to clean the searchState. * It takes in the current props of the higher-order component and the searchState of all widgets and expect a new searchState in return. * props are the props that were provided to the higher-order component. - * searchState holds the searchState of all widgets, with the shape {[widgetId]: widgetState}. Stateful widgets describe the format of their searchState in their respective documentation entry. + * searchState holds the searchState of all widgets, with the shape {[widgetId]: widgetState}. Stateful widgets describe the format of their searchState + * in their respective documentation entry. */ cleanUp?(...args: any[]): any; }