instantsearch.js 4.40.5 → 4.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2003,9 +2003,15 @@ declare type HTMLMarkerArguments = {
2003
2003
 
2004
2004
  declare const index: (widgetParams: IndexWidgetParams) => IndexWidget;
2005
2005
 
2006
- declare type IndexInitOptions = Pick<InitOptions, 'instantSearchInstance' | 'parent' | 'uiState'>;
2006
+ declare type IndexInitOptions = {
2007
+ instantSearchInstance: InstantSearch;
2008
+ parent: IndexWidget | null;
2009
+ uiState: UiState;
2010
+ };
2007
2011
 
2008
- declare type IndexRenderOptions = Pick<RenderOptions, 'instantSearchInstance'>;
2012
+ declare type IndexRenderOptions = {
2013
+ instantSearchInstance: InstantSearch;
2014
+ };
2009
2015
 
2010
2016
  declare type IndexRenderState = Partial<ConnectorRenderStates & WidgetRenderStates>;
2011
2017
 
@@ -2280,7 +2286,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2280
2286
  client: InstantSearchOptions['searchClient'];
2281
2287
  indexName: string;
2282
2288
  insightsClient: InsightsClient | null;
2283
- onStateChange: InstantSearchOptions['onStateChange'] | null;
2289
+ onStateChange: InstantSearchOptions<TUiState>['onStateChange'] | null;
2284
2290
  helper: AlgoliaSearchHelper | null;
2285
2291
  mainHelper: AlgoliaSearchHelper | null;
2286
2292
  mainIndex: IndexWidget;
@@ -2290,9 +2296,9 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2290
2296
  _stalledSearchDelay: number;
2291
2297
  _searchStalledTimer: any;
2292
2298
  _isSearchStalled: boolean;
2293
- _initialUiState: UiState;
2299
+ _initialUiState: TUiState;
2294
2300
  _initialResults: InitialResults | null;
2295
- _createURL: CreateURL<UiState>;
2301
+ _createURL: CreateURL<TUiState>;
2296
2302
  _searchFunction?: InstantSearchOptions['searchFunction'];
2297
2303
  _mainHelperSearch?: AlgoliaSearchHelper['search'];
2298
2304
  middleware: Array<{
@@ -2362,13 +2368,13 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2362
2368
  cancel(): void;
2363
2369
  };
2364
2370
  scheduleStalledRender(): void;
2365
- setUiState(uiState: UiState | ((previousUiState: UiState) => UiState)): void;
2366
- getUiState(): UiState;
2371
+ setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState)): void;
2372
+ getUiState(): TUiState;
2367
2373
  onInternalStateChange: ((...args: any[]) => void) & {
2368
2374
  wait(): Promise<void>;
2369
2375
  cancel(): void;
2370
2376
  };
2371
- createURL(nextState?: UiState): string;
2377
+ createURL(nextState?: TUiState): string;
2372
2378
  refresh(): void;
2373
2379
  }
2374
2380
 
@@ -2460,8 +2466,8 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2460
2466
  * become in charge of updating the UI state with the `setUiState` function.
2461
2467
  */
2462
2468
  onStateChange?: (params: {
2463
- uiState: UiState;
2464
- setUiState(uiState: UiState | ((previousUiState: UiState) => UiState)): void;
2469
+ uiState: TUiState;
2470
+ setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState)): void;
2465
2471
  }) => void;
2466
2472
  /**
2467
2473
  * Injects a `uiState` to the `instantsearch` instance. You can use this option
@@ -2469,7 +2475,7 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2469
2475
  * for the first search. To unconditionally pass additional parameters to the
2470
2476
  * Algolia API, take a look at the `configure` widget.
2471
2477
  */
2472
- initialUiState?: TUiState;
2478
+ initialUiState?: NoInfer<TUiState>;
2473
2479
  /**
2474
2480
  * Time before a search is considered stalled. The default is 200ms
2475
2481
  */
@@ -2773,6 +2779,8 @@ declare namespace middlewares {
2773
2779
  }
2774
2780
  }
2775
2781
 
2782
+ declare type NoInfer<T> = [T][T extends any ? 0 : never];
2783
+
2776
2784
  declare const numericMenu: NumericMenuWidget;
2777
2785
 
2778
2786
  declare type NumericMenuComponentCSSClasses = ComponentCSSClasses<NumericMenuCSSClasses>;
@@ -4595,7 +4603,7 @@ declare type SendEventForToggle = BuiltInSendEventForToggle & CustomSendEventFor
4595
4603
 
4596
4604
  declare type SharedRenderOptions = {
4597
4605
  instantSearchInstance: InstantSearch;
4598
- parent: IndexWidget | null;
4606
+ parent: IndexWidget;
4599
4607
  templatesConfig: Record<string, unknown>;
4600
4608
  scopedResults: ScopedResult[];
4601
4609
  state: SearchParameters;
@@ -2003,9 +2003,15 @@ declare type HTMLMarkerArguments = {
2003
2003
 
2004
2004
  declare const index: (widgetParams: IndexWidgetParams) => IndexWidget;
2005
2005
 
2006
- declare type IndexInitOptions = Pick<InitOptions, 'instantSearchInstance' | 'parent' | 'uiState'>;
2006
+ declare type IndexInitOptions = {
2007
+ instantSearchInstance: InstantSearch;
2008
+ parent: IndexWidget | null;
2009
+ uiState: UiState;
2010
+ };
2007
2011
 
2008
- declare type IndexRenderOptions = Pick<RenderOptions, 'instantSearchInstance'>;
2012
+ declare type IndexRenderOptions = {
2013
+ instantSearchInstance: InstantSearch;
2014
+ };
2009
2015
 
2010
2016
  declare type IndexRenderState = Partial<ConnectorRenderStates & WidgetRenderStates>;
2011
2017
 
@@ -2280,7 +2286,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2280
2286
  client: InstantSearchOptions['searchClient'];
2281
2287
  indexName: string;
2282
2288
  insightsClient: InsightsClient | null;
2283
- onStateChange: InstantSearchOptions['onStateChange'] | null;
2289
+ onStateChange: InstantSearchOptions<TUiState>['onStateChange'] | null;
2284
2290
  helper: AlgoliaSearchHelper | null;
2285
2291
  mainHelper: AlgoliaSearchHelper | null;
2286
2292
  mainIndex: IndexWidget;
@@ -2290,9 +2296,9 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2290
2296
  _stalledSearchDelay: number;
2291
2297
  _searchStalledTimer: any;
2292
2298
  _isSearchStalled: boolean;
2293
- _initialUiState: UiState;
2299
+ _initialUiState: TUiState;
2294
2300
  _initialResults: InitialResults | null;
2295
- _createURL: CreateURL<UiState>;
2301
+ _createURL: CreateURL<TUiState>;
2296
2302
  _searchFunction?: InstantSearchOptions['searchFunction'];
2297
2303
  _mainHelperSearch?: AlgoliaSearchHelper['search'];
2298
2304
  middleware: Array<{
@@ -2362,13 +2368,13 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2362
2368
  cancel(): void;
2363
2369
  };
2364
2370
  scheduleStalledRender(): void;
2365
- setUiState(uiState: UiState | ((previousUiState: UiState) => UiState)): void;
2366
- getUiState(): UiState;
2371
+ setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState)): void;
2372
+ getUiState(): TUiState;
2367
2373
  onInternalStateChange: ((...args: any[]) => void) & {
2368
2374
  wait(): Promise<void>;
2369
2375
  cancel(): void;
2370
2376
  };
2371
- createURL(nextState?: UiState): string;
2377
+ createURL(nextState?: TUiState): string;
2372
2378
  refresh(): void;
2373
2379
  }
2374
2380
 
@@ -2460,8 +2466,8 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2460
2466
  * become in charge of updating the UI state with the `setUiState` function.
2461
2467
  */
2462
2468
  onStateChange?: (params: {
2463
- uiState: UiState;
2464
- setUiState(uiState: UiState | ((previousUiState: UiState) => UiState)): void;
2469
+ uiState: TUiState;
2470
+ setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState)): void;
2465
2471
  }) => void;
2466
2472
  /**
2467
2473
  * Injects a `uiState` to the `instantsearch` instance. You can use this option
@@ -2469,7 +2475,7 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2469
2475
  * for the first search. To unconditionally pass additional parameters to the
2470
2476
  * Algolia API, take a look at the `configure` widget.
2471
2477
  */
2472
- initialUiState?: TUiState;
2478
+ initialUiState?: NoInfer<TUiState>;
2473
2479
  /**
2474
2480
  * Time before a search is considered stalled. The default is 200ms
2475
2481
  */
@@ -2773,6 +2779,8 @@ declare namespace middlewares {
2773
2779
  }
2774
2780
  }
2775
2781
 
2782
+ declare type NoInfer<T> = [T][T extends any ? 0 : never];
2783
+
2776
2784
  declare const numericMenu: NumericMenuWidget;
2777
2785
 
2778
2786
  declare type NumericMenuComponentCSSClasses = ComponentCSSClasses<NumericMenuCSSClasses>;
@@ -4595,7 +4603,7 @@ declare type SendEventForToggle = BuiltInSendEventForToggle & CustomSendEventFor
4595
4603
 
4596
4604
  declare type SharedRenderOptions = {
4597
4605
  instantSearchInstance: InstantSearch;
4598
- parent: IndexWidget | null;
4606
+ parent: IndexWidget;
4599
4607
  templatesConfig: Record<string, unknown>;
4600
4608
  scopedResults: ScopedResult[];
4601
4609
  state: SearchParameters;