Fix dtslint errors

This commit is contained in:
Gordon
2018-10-16 12:32:46 -05:00
parent fcb0cd4753
commit 2ec8d563d7
3 changed files with 544 additions and 550 deletions
+202 -200
View File
@@ -1,203 +1,205 @@
declare module 'react-instantsearch/connectors' {
import { AlgoliaError, BasicDoc, ConnectedComponentType, ISearchResults, ISearchState } from 'react-instantsearch/types'
import { AlgoliaError, BasicDoc, ConnectedComponentType, SearchResults, SearchState } from '../types';
export function connectConfigure(...args: any[]): any
type NESW = { northEast: { lat: number, lng: number }, southWest: { lat: number, lng: number } }
interface IGeoSearchExposed {
defaultRefinement?: NESW
}
interface IGeoSearchProvided<THit> {
/** a function to toggle the refinement */
refine?: (refinement: NESW) => void
/** a function to generate a URL for the corresponding search state */
createURL?: Function
/** the records that matched the search */
hits: THit[]
/** true if the current refinement is set with the map bounds */
isRefinedWithMap?: boolean
/** the refinement currently applied */
currentRefinement?: NESW
/** the position of the search */
position?: { lat: number, lng: number }
}
/**
* The GeoSearch connector provides the logic to build a widget that will display the results on a map.
* It also provides a way to search for results based on their position. The connector provides function to manage the
* search experience (search on map interaction).
*
* https://community.algolia.com/react-instantsearch/connectors/connectGeoSearch.html
*/
export function connectGeoSearch<TProps extends IGeoSearchProvided<THit>, THit>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, IGeoSearchProvided<THit>, IGeoSearchExposed>
export function connectCurrentRefinements(...args: any[]): any
export function connectHierarchicalMenu(...args: any[]): any
export function connectHighlight(...args: any[]): any
/**
* connectHits connector provides the logic to create connected components that will render the results retrieved from Algolia.
* To configure the number of hits retrieved, use HitsPerPage widget, connectHitsPerPage connector or pass the hitsPerPage prop to a Configure widget.
* Warning: you will need to use the objectID property available on every hit as a key when iterating over them. This will ensure you have the best possible UI experience especially on slow networks.
*
* https://community.algolia.com/react-instantsearch/connectors/connectHits.html
*/
export function connectHits<TProps extends { hits: THit[]}, THit>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, {hits?: THit[]}>
export function connectAutoComplete(...args: any[]): any
export function connectHitsPerPage(...args: any[]): any
export function connectInfiniteHits(...args: any[]): any
interface IMenuProvided {
items?: Array<{count: number, isRefined: boolean, label: string, value: string}>,
currentRefinement?: string,
refine?: Function,
createURL?: Function,
searchForItems?: Function,
isFromSearch?: boolean
}
interface IMenuExposed {
attribute: string
showMore?: boolean,
limit?: number,
showMoreLimit?: number,
defaultRefinement?: string,
transformItems?: Function,
searchable?: boolean,
}
/**
* connectMenu connector provides the logic to build a widget that will give the user the ability to choose a single value for a specific facet.
*
* https://community.algolia.com/react-instantsearch/connectors/connectMenu.html
*/
export function connectMenu<TProps extends IMenuProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, IMenuProvided, IMenuExposed>
interface INumericMenuProvided {
/** the list of ranges the NumericMenu can display. */
items?: Array<{isRefined: boolean, label: string, value: string, noRefinement: boolean}>,
/**
* the refinement currently applied. follow the shape of a string with a pattern of '{start}:{end}' which corresponds to the current selected item.
* For instance, when the selected item is {start: 10, end: 20}, the searchState of the widget is '10:20'. When start isn’t defined, the searchState
* of the widget is ':{end}', and the same way around when end isn’t defined. However, when neither start nor end are defined, the searchState is an empty string.
*/
currentRefinement?: string,
/** a function to select a range. */
refine?: Function,
/** a function to generate a URL for the corresponding search state */
createURL?: Function
}
interface INumericMenuExposed {
id?: string
/** the name of the attribute in the records */
attribute: string
/** List of options. With a text label, and upper and lower bounds. */
items: Array<{
label: string | JSX.Element,
start?: number,
end?: number,
}>
/** the value of the item selected by default, follow the shape of a string with a pattern of '{start}:{end}'. */
defaultRefinement?: string
/** Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return. */
transformItems?: Function
}
/**
* connectNumericMenu connector provides the logic to build a widget that will give the user the ability to select a range value for a numeric attribute.
* Ranges are defined statically.
*
* https://community.algolia.com/react-instantsearch/connectors/connectNumericMenu.html
*/
export function connectNumericMenu<TProps extends INumericMenuProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, INumericMenuProvided, INumericMenuExposed>
export function connectPagination(...args: any[]): any
export function connectPoweredBy(...args: any[]): any
export function connectRange(...args: any[]): any
interface IRefinementListProvided {
/** a function to toggle a refinement */
refine: Function,
/** a function to generate a URL for the corresponding search state */
createURL: Function,
/** the refinement currently applied */
currentRefinement: string[],
/** the list of items the RefinementList can display. */
items: Array<{ count: number, isRefined: boolean, label: string, value: string }>,
/** a function to toggle a search inside items values */
searchForItems: Function,
/** a boolean that says if the items props contains facet values from the global search or from the search inside items. */
isFromSearch: boolean
}
interface IRefinementListExposed {
/** the name of the attribute in the record */
attribute: string,
/** allow search inside values */
searchable?: boolean
/** How to apply the refinements. Possible values: ‘or’ or ‘and’. */
operator?: 'or' | 'and'
/** true if the component should display a button that will expand the number of items */
showMore?: boolean
/** the minimum number of displayed items */
limit?: number
/** the maximun number of displayed items. Only used when showMore is set to true */
showMoreLimit?: number
/**
* the values of the items selected by default. The searchState of this widget takes the form of a list of strings, which correspond to the values of all selected refinements. However, when there are no refinements selected, the value of the searchState is an empty string.
*/
defaultRefinement: string[]
/** Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return. */
transformItems?: Function
}
/**
* connectRefinementList connector provides the logic to build a widget that will give the user the ability to choose multiple values for a specific facet.
*
* https://community.algolia.com/react-instantsearch/connectors/connectRefinementList.html
*/
export function connectRefinementList<TProps extends IRefinementListProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, IRefinementListProvided, IRefinementListExposed>
export function connectScrollTo(...args: any[]): any
export function connectBreadcrumb(...args: any[]): any
export interface ISearchBoxProvided {
/** a function to change the current query */
refine?: Function
/** the current query used */
currentRefinement?: string
/** a flag that indicates if InstantSearch has detected that searches are stalled */
isSearchStalled?: boolean
}
export interface ISearchBoxExposed {
/** Provide a default value for the query */
defaultRefinement?: string
}
export function connectSearchBox<TProps extends ISearchBoxProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, ISearchBoxProvided, ISearchBoxExposed>
export function connectSortBy(...args: any[]): any
export function connectStats(...args: any[]): any
export function connectToggleRefinement(...args: any[]): any
export interface IStateResultsProvided<TDoc = BasicDoc> {
/** The search state of the instant search component. */
searchState?: ISearchState,
/**
* The search results.
* In case of multiple indices: if used under <Index>, results will be those of the corresponding index
* otherwise it’ll be those of the root index
*/
searchResults?: ISearchResults<TDoc>,
/** In case of multiple indices you can retrieve all the results */
allSearchResults?: ISearchResults<TDoc>,
/** If there is a search in progress. */
searching?: boolean,
/** Flag that indicates if React InstantSearch has detected that searches are stalled. */
isSearchStalled?: any,
/** If the search failed, the error will be logged here. */
error?: AlgoliaError,
/** If there is a search in a list in progress. */
searchingForFacetValues?: any
}
/**
* The connectStateResults connector provides a way to access the `searchState` and the `searchResults` of InstantSearch.
* For instance this connector allows you to create results/noResults or query/noQuery pages.
*
* https://community.algolia.com/react-instantsearch/connectors/connectStateResults.html
*/
export function connectStateResults<TProps extends IStateResultsProvided<TDoc>, TDoc>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, IStateResultsProvided<TDoc>>
export function connectConfigure(...args: any[]): any;
export interface NESW {
northEast: { lat: number, lng: number };
southWest: { lat: number, lng: number };
}
export interface GeoSearchExposed {
defaultRefinement?: NESW;
}
export interface GeoSearchProvided<THit> {
/** a function to toggle the refinement */
refine?: (refinement: NESW) => void;
/** a function to generate a URL for the corresponding search state */
createURL?: (...args: any[]) => any;
/** the records that matched the search */
hits: THit[];
/** true if the current refinement is set with the map bounds */
isRefinedWithMap?: boolean;
/** the refinement currently applied */
currentRefinement?: NESW;
/** the position of the search */
position?: { lat: number, lng: number };
}
/**
* The GeoSearch connector provides the logic to build a widget that will display the results on a map.
* It also provides a way to search for results based on their position. The connector provides function to manage the
* search experience (search on map interaction).
*
* https://community.algolia.com/react-instantsearch/connectors/connectGeoSearch.html
*/
export function connectGeoSearch<TProps extends GeoSearchProvided<THit>, THit>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, GeoSearchProvided<THit>, IGeoSearchExposed>;
export function connectCurrentRefinements(...args: any[]): any;
export function connectHierarchicalMenu(...args: any[]): any;
export function connectHighlight(...args: any[]): any;
/**
* connectHits connector provides the logic to create connected components that will render the results retrieved from Algolia.
* To configure the number of hits retrieved, use HitsPerPage widget, connectHitsPerPage connector or pass the hitsPerPage prop to a Configure widget.
* Warning: you will need to use the objectID property available on every hit as a key when iterating over them. This will ensure you have the best possible UI experience especially on slow networks.
*
* https://community.algolia.com/react-instantsearch/connectors/connectHits.html
*/
export function connectHits<TProps extends { hits: THit[]}, THit>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, {hits?: THit[]}>;
export function connectAutoComplete(...args: any[]): any;
export function connectHitsPerPage(...args: any[]): any;
export function connectInfiniteHits(...args: any[]): any;
export interface MenuProvided {
items?: Array<{count: number, isRefined: boolean, label: string, value: string}>;
currentRefinement?: string;
refine?: (...args: any[]) => any;
createURL?: (...args: any[]) => any;
searchForItems?: (...args: any[]) => any;
isFromSearch?: boolean;
}
export interface MenuExposed {
attribute: string;
showMore?: boolean;
limit?: number;
showMoreLimit?: number;
defaultRefinement?: string;
transformItems?: (...args: any[]) => any;
searchable?: boolean;
}
/**
* connectMenu connector provides the logic to build a widget that will give the user the ability to choose a single value for a specific facet.
*
* https://community.algolia.com/react-instantsearch/connectors/connectMenu.html
*/
export function connectMenu<TProps extends MenuProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, MenuProvided, MenuExposed>;
export interface NumericMenuProvided {
/** the list of ranges the NumericMenu can display. */
items?: Array<{isRefined: boolean, label: string, value: string, noRefinement: boolean}>;
/**
* the refinement currently applied. follow the shape of a string with a pattern of '{start}:{end}' which corresponds to the current selected item.
* For instance, when the selected item is {start: 10, end: 20}, the searchState of the widget is '10:20'. When start isn’t defined, the searchState
* of the widget is ':{end}', and the same way around when end isn’t defined. However, when neither start nor end are defined, the searchState is an empty string.
*/
currentRefinement?: string;
/** a function to select a range. */
refine?: (...args: any[]) => any;
/** a function to generate a URL for the corresponding search state */
createURL?: (...args: any[]) => any;
}
export interface NumericMenuExposed {
id?: string;
/** the name of the attribute in the records */
attribute: string;
/** List of options. With a text label, and upper and lower bounds. */
items: Array<{
label: string | JSX.Element;
start?: number;
end?: number;
}>;
/** the value of the item selected by default, follow the shape of a string with a pattern of '{start}:{end}'. */
defaultRefinement?: string;
/** (...args: any[]) => any to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return. */
transformItems?: (...args: any[]) => any;
}
/**
* connectNumericMenu connector provides the logic to build a widget that will give the user the ability to select a range value for a numeric attribute.
* Ranges are defined statically.
*
* https://community.algolia.com/react-instantsearch/connectors/connectNumericMenu.html
*/
export function connectNumericMenu<TProps extends NumericMenuProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, NumericMenuProvided, NumericMenuExposed>;
export function connectPagination(...args: any[]): any;
export function connectPoweredBy(...args: any[]): any;
export function connectRange(...args: any[]): any;
export interface RefinementListProvided {
/** a function to toggle a refinement */
refine: (...args: any[]) => any;
/** a function to generate a URL for the corresponding search state */
createURL: (...args: any[]) => any;
/** the refinement currently applied */
currentRefinement: string[];
/** the list of items the RefinementList can display. */
items: Array<{ count: number, isRefined: boolean, label: string, value: string }>;
/** a function to toggle a search inside items values */
searchForItems: (...args: any[]) => any;
/** a boolean that says if the items props contains facet values from the global search or from the search inside items. */
isFromSearch: boolean;
}
export interface RefinementListExposed {
/** the name of the attribute in the record */
attribute: string;
/** allow search inside values */
searchable?: boolean;
/** How to apply the refinements. Possible values: ‘or’ or ‘and’. */
operator?: 'or' | 'and';
/** true if the component should display a button that will expand the number of items */
showMore?: boolean;
/** the minimum number of displayed items */
limit?: number;
/** the maximun number of displayed items. Only used when showMore is set to true */
showMoreLimit?: number;
/**
* the values of the items selected by default. The searchState of this widget takes the form of a list of strings,
* which correspond to the values of all selected refinements. However, when there are no refinements selected,
* the value of the searchState is an empty string.
*/
defaultRefinement: string[];
/** (...args: any[]) => any to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return. */
transformItems?: (...args: any[]) => any;
}
/**
* connectRefinementList connector provides the logic to build a widget that will give the user the ability to choose multiple values for a specific facet.
*
* https://community.algolia.com/react-instantsearch/connectors/connectRefinementList.html
*/
export function connectRefinementList<TProps extends RefinementListProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, RefinementListProvided, RefinementListExposed>;
export function connectScrollTo(...args: any[]): any;
export function connectBreadcrumb(...args: any[]): any;
export interface SearchBoxProvided {
/** a function to change the current query */
refine?: (...args: any[]) => any;
/** the current query used */
currentRefinement?: string;
/** a flag that indicates if InstantSearch has detected that searches are stalled */
isSearchStalled?: boolean;
}
export interface SearchBoxExposed {
/** Provide a default value for the query */
defaultRefinement?: string;
}
export function connectSearchBox<TProps extends SearchBoxProvided>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, SearchBoxProvided, SearchBoxExposed>;
export function connectSortBy(...args: any[]): any;
export function connectStats(...args: any[]): any;
export function connectToggleRefinement(...args: any[]): any;
export interface StateResultsProvided<TDoc = BasicDoc> {
/** The search state of the instant search component. */
searchState?: SearchState;
/**
* The search results.
* In case of multiple indices: if used under <Index>, results will be those of the corresponding index
* otherwise it’ll be those of the root index
*/
searchResults?: SearchResults<TDoc>;
/** In case of multiple indices you can retrieve all the results */
allSearchResults?: SearchResults<TDoc>;
/** If there is a search in progress. */
searching?: boolean;
/** Flag that indicates if React InstantSearch has detected that searches are stalled. */
isSearchStalled?: any;
/** If the search failed, the error will be logged here. */
error?: AlgoliaError;
/** If there is a search in a list in progress. */
searchingForFacetValues?: any;
}
/**
* The connectStateResults connector provides a way to access the `searchState` and the `searchResults` of InstantSearch.
* For instance this connector allows you to create results/noResults or query/noQuery pages.
*
* https://community.algolia.com/react-instantsearch/connectors/connectStateResults.html
*/
export function connectStateResults<TProps extends StateResultsProvided<TDoc>, TDoc>(ctor: React.ComponentType<TProps>): ConnectedComponentType<TProps, StateResultsProvided<TDoc>>;
+101 -104
View File
@@ -1,110 +1,107 @@
declare module 'react-instantsearch/dom' {
import { Hit, BasicDoc } from 'react-instantsearch/types'
import { Hit, BasicDoc } from '../types';
// Core
export function createConnector(...args: any[]): any
// Core
export function createConnector(...args: any[]): any;
// Widget
// Widget
/**
* Configure is a widget that lets you provide raw search parameters to the Algolia API.
* Any of the props added to this widget will be forwarded to Algolia. For more information on the different parameters that can be set, have a look at the reference.
*
* https://community.algolia.com/react-instantsearch/widgets/Configure.html
*/
export class Configure extends React.Component<any, any> {}
// DOM
export interface CommonWidgetProps {
/**
* Configure is a widget that lets you provide raw search parameters to the Algolia API.
* Any of the props added to this widget will be forwarded to Algolia. For more information on the different parameters that can be set, have a look at the reference.
*
* https://community.algolia.com/react-instantsearch/widgets/Configure.html
* All static text rendered by widgets, such as “Load more”, “Show more” are translatable using the translations prop on relevant widgets.
* This prop is a mapping of keys to translation values. Translation values can be either a String or a (...args: any[]) => any, as some take parameters.
*
* https://community.algolia.com/react-instantsearch/guide/i18n.html
*/
export class Configure extends React.Component<any, any>{}
// DOM
interface CommonWidgetProps {
/**
* All static text rendered by widgets, such as “Load more”, “Show more” are translatable using the translations prop on relevant widgets.
* This prop is a mapping of keys to translation values. Translation values can be either a String or a Function, as some take parameters.
*
* https://community.algolia.com/react-instantsearch/guide/i18n.html
*/
translations?: { [key: string]: string | Function }
}
interface InstantSearchProps {
apiKey: string,
appId: string,
indexName: string,
algoliaClient?: any,
searchClient?: any,
createURL?: Function,
searchState?: any,
refresh?: boolean,
onSearchStateChange?: Function,
onSearchParameters?: Function,
resultsState?: any | any[],
root?: {
Root: string | Function,
props: any
}
}
/**
* <InstantSearch> is the root component of all React InstantSearch implementations. It provides all the connected components (aka widgets) a means to interact with the searchState.
*
* https://community.algolia.com/react-instantsearch/widgets/%3CInstantSearch%3E.html
*/
export class InstantSearch extends React.Component<InstantSearchProps> {}
export class Index extends React.Component<any> {}
export class Breadcrumb extends React.Component<any> {}
export class ClearRefinements extends React.Component<any> {}
export class CurrentRefinements extends React.Component<any> {}
export class HierarchicalMenu extends React.Component<any> {}
export class Highlight extends React.Component<any> {}
interface HitsProps<T> {
hitComponent: React.ComponentType<{ hit: Hit<T> }>
}
/**
* Displays a list of hits.
* To configure the number of hits being shown, use the HitsPerPage widget, connectHitsPerPage connector or the Configure widget.
*
* https://community.algolia.com/react-instantsearch/widgets/Hits.html
*/
export class Hits<T = BasicDoc> extends React.Component<HitsProps<T>> {}
export class HitsPerPage extends React.Component<any> {}
export class InfiniteHits extends React.Component<any> {}
export class Menu extends React.Component<any> {}
export class MenuSelect extends React.Component<any> {}
export class NumericMenu extends React.Component<any> {}
export class Pagination extends React.Component<any> {}
export class Panel extends React.Component<any> {}
export class PoweredBy extends React.Component<any> {}
export class RangeInput extends React.Component<any> {}
export class RangeSlider extends React.Component<any> {}
export class RatingMenu extends React.Component<any> {}
export class RefinementList extends React.Component<any> {}
export class ScrollTo extends React.Component<any> {}
interface SearchBoxProps extends CommonWidgetProps {
focusShortcuts?: string[],
autoFocus?: boolean,
defaultRefinement?: string,
searchAsYouType?: boolean,
showLoadingIndicator?: boolean,
submit?: JSX.Element,
reset?: JSX.Element,
loadingIndicator?: JSX.Element,
onSubmit?: Function,
onReset?: Function,
}
/**
* The SearchBox component displays a search box that lets the user search for a specific query.
*
* https://community.algolia.com/react-instantsearch/widgets/SearchBox.html
*/
export class SearchBox extends React.Component<SearchBoxProps> {}
export class Snippet extends React.Component<any> {}
export class SortBy extends React.Component<any> {}
/**
* The Stats component displays the total number of matching hits and the time it took to get them (time spent in the Algolia server).
*/
export class Stats extends React.Component<{translations?: { [key: string]: (n: number, ms: number) => string }}> {}
export class ToggleRefinement extends React.Component<any> {}
translations?: { [key: string]: string | (...args: any[]) => any };
}
export interface InstantSearchProps {
apiKey: string;
appId: string;
indexName: string;
algoliaClient?: any;
searchClient?: any;
createURL?: (...args: any[]) => any;
searchState?: any;
refresh?: boolean;
onSearchStateChange?: (...args: any[]) => any;
onSearchParameters?: (...args: any[]) => any;
resultsState?: any;
root?: {
Root: string | (...args: any[]) => any;
props: any;
};
}
/**
* <InstantSearch> is the root component of all React InstantSearch implementations. It provides all the connected components (aka widgets) a means to interact with the searchState.
*
* https://community.algolia.com/react-instantsearch/widgets/%3CInstantSearch%3E.html
*/
export class InstantSearch extends React.Component<InstantSearchProps> {}
export class Index extends React.Component<any> {}
export class Breadcrumb extends React.Component<any> {}
export class ClearRefinements extends React.Component<any> {}
export class CurrentRefinements extends React.Component<any> {}
export class HierarchicalMenu extends React.Component<any> {}
export class Highlight extends React.Component<any> {}
export interface HitsProps<T> {
hitComponent: React.ComponentType<{ hit: Hit<T> }>;
}
/**
* Displays a list of hits.
* To configure the number of hits being shown, use the HitsPerPage widget, connectHitsPerPage connector or the Configure widget.
*
* https://community.algolia.com/react-instantsearch/widgets/Hits.html
*/
export class Hits<T = BasicDoc> extends React.Component<HitsProps<T>> {}
export class HitsPerPage extends React.Component<any> {}
export class InfiniteHits extends React.Component<any> {}
export class Menu extends React.Component<any> {}
export class MenuSelect extends React.Component<any> {}
export class NumericMenu extends React.Component<any> {}
export class Pagination extends React.Component<any> {}
export class Panel extends React.Component<any> {}
export class PoweredBy extends React.Component<any> {}
export class RangeInput extends React.Component<any> {}
export class RangeSlider extends React.Component<any> {}
export class RatingMenu extends React.Component<any> {}
export class RefinementList extends React.Component<any> {}
export class ScrollTo extends React.Component<any> {}
export interface SearchBoxProps extends CommonWidgetProps {
focusShortcuts?: string[];
autoFocus?: boolean;
defaultRefinement?: string;
searchAsYouType?: boolean;
showLoadingIndicator?: boolean;
submit?: JSX.Element;
reset?: JSX.Element;
loadingIndicator?: JSX.Element;
onSubmit?: (...args: any[]) => any;
onReset?: (...args: any[]) => any;
}
/**
* The SearchBox component displays a search box that lets the user search for a specific query.
*
* https://community.algolia.com/react-instantsearch/widgets/SearchBox.html
*/
export class SearchBox extends React.Component<SearchBoxProps> {}
export class Snippet extends React.Component<any> {}
export class SortBy extends React.Component<any> {}
/**
* The Stats component displays the total number of matching hits and the time it took to get them (time spent in the Algolia server).
*/
export class Stats extends React.Component<{translations?: { [key: string]: (n: number, ms: number) => string }}> {}
export class ToggleRefinement extends React.Component<any> {}
+241 -246
View File
@@ -1,272 +1,267 @@
declare module 'react-instantsearch/types' {
export interface AlgoliaError {
stack: string;
name: string;
message: string;
debugData: any[];
statusCode: number;
}
type AlgoliaError = {
stack: string
name: string
message: string
debugData: any[],
statusCode: number
}
export type Omit<T1, T2> = Pick<T1, Exclude<keyof T1, keyof T2>>;
type Omit<T1, T2> = Pick<T1, Exclude<keyof T1, keyof T2>>
export type ConnectedComponentType<TProps, TProvidedProps, TExposedProps = {}>
= React.ComponentType<Omit<TProps, TProvidedProps> & TExposedProps>;
type ConnectedComponentType<TProps, TProvidedProps, TExposedProps = {}>
= React.ComponentType<Omit<TProps, TProvidedProps> & TExposedProps>
/**
* The searchState contains all widgets states. If a widget uses an attribute,
* we store it under its widget category to prevent collision.
*
* https://community.algolia.com/react-instantsearch/guide/Search_state.html
*/
export interface SearchState {
range: {
[key: string]: {
min: number;
max: number;
}
};
configure: {
aroundLatLng: boolean;
[key: string]: any;
};
refinementList: {
[key: string]: string[]
};
hierarchicalMenu: {
[key: string]: string
};
menu: {
[key: string]: string
};
multiRange: {
[key: string]: string
};
toggle: {
[key: string]: boolean
};
hitsPerPage: number;
sortBy: string;
query: string;
page: number;
indices?: {
[index: string]: {
configure: {
hitsPerPage: number,
},
}
};
}
/**
* The searchState contains all widgets states. If a widget uses an attribute,
* we store it under its widget category to prevent collision.
*
* https://community.algolia.com/react-instantsearch/guide/Search_state.html
*/
export interface ISearchState {
range: {
[key: string]: {
min: number,
max: number
}
/**
* The most basic possible document in an Algolia index:
* a set of string-value pairs.
*/
export interface BasicDoc { [k: string]: string; }
/**
* The shape of the searchResults object provided
* via connectors
* https://community.algolia.com/algoliasearch-helper-js/reference.html#searchresults
*/
export interface SearchResults<TDoc = BasicDoc> {
query: string;
hits: Array<Hit<TDoc>>;
index: string;
hitsPerPage: number;
nbHits: number;
nbPages: number;
page: number;
processingTimeMS: number;
exhaustiveNbHits: true;
disjunctiveFacets: any[];
hierarchicalFacets: any[];
facets: any[];
aroundLatLng?: string;
automaticRadius?: string;
}
/**
* All the records that match the search parameters.
* Each record is augmented with a new attribute `_highlightResult` which is an
* object keyed by attribute and contains additional properties
* https://community.algolia.com/algoliasearch-helper-js/reference.html#SearchResults#hits
*/
export type Hit<TDoc> = TDoc & {
objectID: string;
'_highlightResult': HighlightResult<TDoc>;
};
export type HighlightResult<TDoc> =
TDoc extends { [k: string]: any } ?
{ [K in keyof TDoc]: HighlightResultField<TDoc[K]> } :
never;
export type HighlightResultField<TField> =
TField extends Array<infer TItem> ?
HighlightResultArray<TItem> :
TField extends string ?
HighlightResultPrimitive :
HighlightResult<TField>;
export type HighlightResultArray<TItem> =
TItem extends string ?
HighlightResultPrimitive[] :
Array<HighlightResult<TItem>>;
export interface HighlightResultPrimitive {
/** the value of the facet highlighted (html) */
value: string;
/** full, partial or none depending on how the query terms match */
matchLevel: 'none' | 'partial' | 'full';
matchedWords: string[];
fullyHighlighted?: boolean;
}
/* Hits example:
{
"title": "Video 3: Nine Characteristics Of A Great Group",
"type": "video",
"tags": [],
"blurb": null,
"security_level": {
"id": 1,
"name": "Anonymous",
"key": "anonymous"
},
"asset": {},
"external_asset": "http://vimeo.com/104767570",
"objectID": "t6qPLQCVNesY84OoikkiW",
"_highlightResult": {
"title": {
"value":
"Video <ais-highlight-0000000000>3</ais-highlight-0000000000>: Nine Characteristics Of A Great Group",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["3"]
},
configure: {
aroundLatLng: boolean,
[key: string]: any
"type": {
"value": "video",
"matchLevel": "none",
"matchedWords": []
},
refinementList: {
[key: string]: string[]
},
hierarchicalMenu: {
[key: string]: string
},
menu: {
[key: string]: string
},
multiRange: {
[key: string]: string
},
toggle: {
[key: string]: boolean
},
hitsPerPage: number,
sortBy: string,
query: string,
page: number,
indices?: {
[index: string]: {
configure: {
hitsPerPage: number,
},
}
},
}
/**
* The most basic possible document in an Algolia index:
* a set of string-value pairs.
*/
export type BasicDoc = { [k: string]: string }
/**
* The shape of the searchResults object provided
* via connectors
* https://community.algolia.com/algoliasearch-helper-js/reference.html#searchresults
*/
export interface ISearchResults<TDoc = BasicDoc> {
query: string,
hits: Array<Hit<TDoc>>,
index: string,
hitsPerPage: number,
nbHits: number,
nbPages: number,
page: number,
processingTimeMS: number,
exhaustiveNbHits: true,
disjunctiveFacets: any[],
hierarchicalFacets: any[],
facets: any[],
aroundLatLng?: string
automaticRadius?: string
}
/**
* All the records that match the search parameters.
* Each record is augmented with a new attribute `_highlightResult` which is an
* object keyed by attribute and contains additional properties
* https://community.algolia.com/algoliasearch-helper-js/reference.html#SearchResults#hits
*/
type Hit<TDoc> = TDoc & {
objectID: string,
'_highlightResult': HighlightResult<TDoc>,
}
type HighlightResult<TDoc> =
TDoc extends { [k: string]: any } ?
{ [K in keyof TDoc]: HighlightResultField<TDoc[K]> } :
never
type HighlightResultField<TField> =
TField extends Array<infer TItem> ?
HighlightResultArray<TItem> :
TField extends string ?
HighlightResultPrimitive :
HighlightResult<TField>
type HighlightResultArray<TItem> =
TItem extends string ?
HighlightResultPrimitive[] :
Array<HighlightResult<TItem>>
type HighlightResultPrimitive = {
/** the value of the facet highlighted (html) */
value: string,
/** full, partial or none depending on how the query terms match */
matchLevel: 'none' | 'partial' | 'full',
matchedWords: string[],
fullyHighlighted?: boolean,
}
/* Hits example:
{
"title": "Video 3: Nine Characteristics Of A Great Group",
"type": "video",
"tags": [],
"blurb": null,
"security_level": {
"id": 1,
"name": "Anonymous",
"key": "anonymous"
"name": {
"value": "Anonymous",
"matchLevel": "none",
"matchedWords": []
},
"key": {
"value": "anonymous",
"matchLevel": "none",
"matchedWords": []
}
},
"asset": {},
"external_asset": "http://vimeo.com/104767570",
"objectID": "t6qPLQCVNesY84OoikkiW",
"_highlightResult": {
"title": {
"value":
"Video <ais-highlight-0000000000>3</ais-highlight-0000000000>: Nine Characteristics Of A Great Group",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["3"]
"external_asset": {
"value": "http://vimeo.com/104767570",
"matchLevel": "none",
"matchedWords": []
},
"asset": {
"sys": {
"locale": {
"value": "en-US",
"matchLevel": "none",
"matchedWords": []
},
"space": {
"sys": {
"type": {
"value": "Link",
"matchLevel": "none",
"matchedWords": []
},
"linkType": {
"value": "Space",
"matchLevel": "none",
"matchedWords": []
},
"id": {
"value": "7yx6ovlj39n5",
"matchLevel": "none",
"matchedWords": []
}
}
},
"id": {
"value": "1AXqjzjSN2u0qgMWCW8uG8",
"matchLevel": "none",
"matchedWords": []
},
"type": {
"value": "video",
"value": "Asset",
"matchLevel": "none",
"matchedWords": []
},
"security_level": {
"name": {
"value": "Anonymous",
"matchLevel": "none",
"matchedWords": []
},
"key": {
"value": "anonymous",
"matchLevel": "none",
"matchedWords": []
}
},
"external_asset": {
"value": "http://vimeo.com/104767570",
"createdAt": {
"value": "2018-06-22T02:42:32.632Z",
"matchLevel": "none",
"matchedWords": []
},
"asset": {
"updatedAt": {
"value": "2018-06-22T02:42:32.632Z",
"matchLevel": "none",
"matchedWords": []
},
"environment": {
"sys": {
"locale": {
"value": "en-US",
"matchLevel": "none",
"matchedWords": []
},
"space": {
"sys": {
"type": {
"value": "Link",
"matchLevel": "none",
"matchedWords": []
},
"linkType": {
"value": "Space",
"matchLevel": "none",
"matchedWords": []
},
"id": {
"value": "7yx6ovlj39n5",
"matchLevel": "none",
"matchedWords": []
}
}
},
"id": {
"value": "1AXqjzjSN2u0qgMWCW8uG8",
"matchLevel": "none",
"matchedWords": []
},
"type": {
"value": "Asset",
"matchLevel": "none",
"matchedWords": []
},
"createdAt": {
"value": "2018-06-22T02:42:32.632Z",
"matchLevel": "none",
"matchedWords": []
},
"updatedAt": {
"value": "2018-06-22T02:42:32.632Z",
"matchLevel": "none",
"matchedWords": []
},
"environment": {
"sys": {
"id": {
"value": "master",
"matchLevel": "none",
"matchedWords": []
},
"type": {
"value": "Link",
"matchLevel": "none",
"matchedWords": []
},
"linkType": {
"value": "Environment",
"matchLevel": "none",
"matchedWords": []
}
}
}
},
"fields": {
"title": {
"value":
"how-to-<ais-highlight-0000000000>confess</ais-highlight-0000000000>-an-<ais-highlight-0000000000>inventory</ais-highlight-0000000000>",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["confess", "inventory"]
},
"file": {
"url": {
"value":
"//assets.ctfassets.net/7yx6ovlj39n5/1AXqjzjSN2u0qgMWCW8uG8/3f598700fa730fe03676130328f8b766/how-to-<ais-highlight-0000000000>confess</ais-highlight-0000000000>-an-<ais-highlight-0000000000>inventory</ais-highlight-0000000000>.docx",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["confess", "inventory"]
"id": {
"value": "master",
"matchLevel": "none",
"matchedWords": []
},
"fileName": {
"value":
"how-to-<ais-highlight-0000000000>confess</ais-highlight-0000000000>-an-<ais-highlight-0000000000>inventory</ais-highlight-0000000000>.docx",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["confess", "inventory"]
"type": {
"value": "Link",
"matchLevel": "none",
"matchedWords": []
},
"contentType": {
"value":
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"linkType": {
"value": "Environment",
"matchLevel": "none",
"matchedWords": []
}
}
}
},
"fields": {
"title": {
"value":
"how-to-<ais-highlight-0000000000>confess</ais-highlight-0000000000>-an-<ais-highlight-0000000000>inventory</ais-highlight-0000000000>",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["confess", "inventory"]
},
"file": {
"url": {
"value":
"//assets.ctfassets.net/how-to-<ais-highlight-0000000000>confess</ais-highlight-0000000000>-an-<ais-highlight-0000000000>inventory</ais-highlight-0000000000>.docx",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["confess", "inventory"]
},
"fileName": {
"value":
"how-to-<ais-highlight-0000000000>confess</ais-highlight-0000000000>-an-<ais-highlight-0000000000>inventory</ais-highlight-0000000000>.docx",
"matchLevel": "full",
"fullyHighlighted": false,
"matchedWords": ["confess", "inventory"]
},
"contentType": {
"value":
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"matchLevel": "none",
"matchedWords": []
}
}
}
}*/
}
}
}*/