Skip to content

Commit

Permalink
do not cast the return of getWidgetRenderState
Browse files Browse the repository at this point in the history
  • Loading branch information
eunjae-lee committed Sep 30, 2020
1 parent 54e31fc commit 614bc53
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 44 deletions.
15 changes: 3 additions & 12 deletions src/connectors/breadcrumb/connectBreadcrumb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ import {
noop,
} from '../../lib/utils';
import { SearchResults } from 'algoliasearch-helper';
import {
Connector,
TransformItems,
CreateURL,
BreadcrumbWidgetRenderState,
} from '../../types';
import { Connector, TransformItems, CreateURL } from '../../types';

const withUsage = createDocumentationMessageGenerator({
name: 'breadcrumb',
Expand Down Expand Up @@ -155,9 +150,7 @@ const connectBreadcrumb: BreadcrumbConnector = function connectBreadcrumb(

renderFn(
{
...(this.getWidgetRenderState!(
initOptions
) as BreadcrumbWidgetRenderState),
...this.getWidgetRenderState!(initOptions),
instantSearchInstance: initOptions.instantSearchInstance,
},
true
Expand All @@ -167,9 +160,7 @@ const connectBreadcrumb: BreadcrumbConnector = function connectBreadcrumb(
render(renderOptions) {
renderFn(
{
...(this.getWidgetRenderState!(
renderOptions
) as BreadcrumbWidgetRenderState),
...this.getWidgetRenderState!(renderOptions),
instantSearchInstance: renderOptions.instantSearchInstance,
},
false
Expand Down
15 changes: 3 additions & 12 deletions src/connectors/clear-refinements/connectClearRefinements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ import {
uniq,
mergeSearchParameters,
} from '../../lib/utils';
import {
TransformItems,
CreateURL,
Connector,
ClearRefinementsWidgetRenderState,
} from '../../types';
import { TransformItems, CreateURL, Connector } from '../../types';

const withUsage = createDocumentationMessageGenerator({
name: 'clear-refinements',
Expand Down Expand Up @@ -108,9 +103,7 @@ const connectClearRefinements: ClearRefinementsConnector = function connectClear

renderFn(
{
...(this.getWidgetRenderState!(
initOptions
) as ClearRefinementsWidgetRenderState),
...this.getWidgetRenderState!(initOptions),
instantSearchInstance,
},
true
Expand Down Expand Up @@ -151,9 +144,7 @@ const connectClearRefinements: ClearRefinementsConnector = function connectClear

renderFn(
{
...(this.getWidgetRenderState!(
renderOptions
) as ClearRefinementsWidgetRenderState),
...this.getWidgetRenderState!(renderOptions),
instantSearchInstance,
},
false
Expand Down
12 changes: 4 additions & 8 deletions src/connectors/configure/connectConfigure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import algoliasearchHelper, {
PlainSearchParameters,
AlgoliaSearchHelper,
} from 'algoliasearch-helper';
import { Connector, ConfigureWidgetRenderState } from '../../types';
import { Connector } from '../../types';
import {
createDocumentationMessageGenerator,
isPlainObject,
Expand Down Expand Up @@ -106,9 +106,7 @@ const connectConfigure: ConfigureConnector = function connectConfigure(

renderFn(
{
...(this.getWidgetRenderState!(
initOptions
) as ConfigureWidgetRenderState),
...this.getWidgetRenderState!(initOptions),
instantSearchInstance,
},
true
Expand All @@ -120,9 +118,7 @@ const connectConfigure: ConfigureConnector = function connectConfigure(

renderFn(
{
...(this.getWidgetRenderState!(
renderOptions
) as ConfigureWidgetRenderState),
...this.getWidgetRenderState!(renderOptions),
instantSearchInstance,
},
false
Expand All @@ -142,7 +138,7 @@ const connectConfigure: ConfigureConnector = function connectConfigure(
};
},

getWidgetRenderState(renderOptions) {
getWidgetRenderState() {
return {
refine: connectorState.refine!,
widgetParams,
Expand Down
15 changes: 3 additions & 12 deletions src/connectors/current-refinements/connectCurrentRefinements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ import {
FacetRefinement,
NumericRefinement,
} from '../../lib/utils/getRefinements';
import {
Connector,
TransformItems,
CreateURL,
CurrentRefinementsWidgetRenderState,
} from '../../types';
import { Connector, TransformItems, CreateURL } from '../../types';

export type CurrentRefinementsConnectorParamsRefinement = {
/**
Expand Down Expand Up @@ -171,9 +166,7 @@ const connectCurrentRefinements: CurrentRefinementsConnector = function connectC

renderFn(
{
...(this.getWidgetRenderState!(
initOptions
) as CurrentRefinementsWidgetRenderState),
...this.getWidgetRenderState!(initOptions),
instantSearchInstance,
},
true
Expand All @@ -185,9 +178,7 @@ const connectCurrentRefinements: CurrentRefinementsConnector = function connectC

renderFn(
{
...(this.getWidgetRenderState!(
renderOptions
) as CurrentRefinementsWidgetRenderState),
...this.getWidgetRenderState!(renderOptions),
instantSearchInstance,
},
false
Expand Down

0 comments on commit 614bc53

Please sign in to comment.