From e16ad5759c9f2f27b64017a3acf7fa92b5a8a6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Wed, 3 Apr 2019 17:11:45 +0200 Subject: [PATCH] fix(connectQueryRules): improve tracked refinement type (#3648) --- src/connectors/query-rules/connectQueryRules.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/connectors/query-rules/connectQueryRules.ts b/src/connectors/query-rules/connectQueryRules.ts index 74bded0509..53795150c3 100644 --- a/src/connectors/query-rules/connectQueryRules.ts +++ b/src/connectors/query-rules/connectQueryRules.ts @@ -18,10 +18,12 @@ import { NumericRefinement as InternalNumericRefinement, } from '../../lib/utils/getRefinements'; +type TrackedFilterRefinement = string | number | boolean; + export type ParamTrackedFilters = { [facetName: string]: ( - facetValues: Array - ) => Array; + facetValues: TrackedFilterRefinement[] + ) => TrackedFilterRefinement[]; }; export type ParamTransformRuleContexts = (ruleContexts: string[]) => string[]; type ParamTransformItems = (items: object[]) => any; @@ -85,7 +87,7 @@ function getRuleContextsFromTrackedFilters({ }) { const ruleContexts = Object.keys(trackedFilters).reduce( (facets, facetName) => { - const facetRefinements: Array = getRefinements( + const facetRefinements: TrackedFilterRefinement[] = getRefinements( helper.lastResults || {}, sharedHelperState )