Skip to content

Commit

Permalink
return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Yen Truong committed Oct 22, 2021
1 parent b79b8d6 commit a936792
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sample-app/src/utils/filterutils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function getFilterDisplayValue(filter: Filter): string {
/**
* convert a list of facets to DisplayableFilter format with only selected facets returned.
*/
function getDisplayableAppliedFacets(facets: DisplayableFacet[] | undefined) {
function getDisplayableAppliedFacets(facets: DisplayableFacet[] | undefined): DisplayableFilter[] {
let appliedFacets: DisplayableFilter[] = [];
facets?.forEach(facet => {
facet.options.forEach(option => {
Expand All @@ -138,7 +138,7 @@ function getDisplayableAppliedFacets(facets: DisplayableFacet[] | undefined) {
/**
* convert a list of static filters to DisplayableFilter format.
*/
function getDisplayableStaticFilters(filters: Filter[]) {
function getDisplayableStaticFilters(filters: Filter[]): DisplayableFilter[] {
let appliedStaticFilters: DisplayableFilter[] = [];
filters?.forEach(filter => {
appliedStaticFilters.push({
Expand All @@ -154,7 +154,7 @@ function getDisplayableStaticFilters(filters: Filter[]) {
/**
* convert a list of nlp filters to DisplayableFilter format.
*/
function getDisplayableNlpFilters(filters: AppliedQueryFilter[]) {
function getDisplayableNlpFilters(filters: AppliedQueryFilter[]): DisplayableFilter[] {
let appliedNlpFilters: DisplayableFilter[] = [];
filters?.forEach(filter => {
appliedNlpFilters.push({
Expand All @@ -175,7 +175,7 @@ export function getGroupedAppliedFilters(
appliedFiltersState: FiltersState,
nlpFilters: AppliedQueryFilter[],
hiddenFields: string[]
) {
): Array<GroupedFilters> {
const displayableStaticFilters = getDisplayableStaticFilters(flattenFilters(appliedFiltersState?.static));
const displayableFacets = getDisplayableAppliedFacets(appliedFiltersState?.facets);
const displayableNlpFilters = getDisplayableNlpFilters(nlpFilters);
Expand Down

0 comments on commit a936792

Please sign in to comment.