Skip to content

Commit

Permalink
fix(types): export widget's types (algolia#4813)
Browse files Browse the repository at this point in the history
* fix(types): export widget's types

* lint
  • Loading branch information
Haroenv authored Jul 19, 2021
1 parent b37e23b commit e9764e9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/widgets/dynamic-widgets/dynamic-widgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ export type DynamicWidgetsWidgetParams = {
widgets: Array<(container: HTMLElement) => Widget>;
};

export type DynamicWidgets = WidgetFactory<
export type DynamicWidgetsWidget = WidgetFactory<
DynamicWidgetsWidgetDescription & { $$widgetType: 'ais.dynamicWidgets' },
Omit<DynamicWidgetsConnectorParams, 'widgets'>,
DynamicWidgetsWidgetParams
>;

const dynamicWidgets: DynamicWidgets = function dynamicWidgets(widgetParams) {
const dynamicWidgets: DynamicWidgetsWidget = function dynamicWidgets(
widgetParams
) {
const { container: containerSelector, transformItems, widgets } =
widgetParams || {};

Expand Down
6 changes: 3 additions & 3 deletions src/widgets/query-rule-context/query-rule-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import connectQueryRules, {
QueryRulesWidgetDescription,
} from '../../connectors/query-rules/connectQueryRules';

type QueryRuleContextWidgetParams = {
export type QueryRuleContextWidgetParams = {
trackedFilters: ParamTrackedFilters;
transformRuleContexts?: ParamTransformRuleContexts;
};

type QueryRuleContext = WidgetFactory<
export type QueryRuleContextWidget = WidgetFactory<
QueryRulesWidgetDescription & { $$widgetType: 'ais.queryRuleContext' },
QueryRulesConnectorParams,
QueryRuleContextWidgetParams
Expand All @@ -22,7 +22,7 @@ const withUsage = createDocumentationMessageGenerator({
name: 'query-rule-context',
});

const queryRuleContext: QueryRuleContext = (
const queryRuleContext: QueryRuleContextWidget = (
widgetParams = {} as QueryRuleContextWidgetParams
) => {
if (!widgetParams.trackedFilters) {
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/query-rule-custom-data/query-rule-custom-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export type QueryRuleCustomDataTemplates = Partial<{
default: Template<{ items: any[] }>;
}>;

type QueryRuleCustomDataWidgetParams = {
export type QueryRuleCustomDataWidgetParams = {
container: string | HTMLElement;
cssClasses?: QueryRuleCustomDataCSSClasses;
templates?: QueryRuleCustomDataTemplates;
};

type QueryRuleCustomDataWidget = WidgetFactory<
export type QueryRuleCustomDataWidget = WidgetFactory<
QueryRulesWidgetDescription & { $$widgetType: 'ais.queryRuleCustomData' },
QueryRulesConnectorParams,
QueryRuleCustomDataWidgetParams
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/relevant-sort/relevant-sort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type RelevantSortWidgetParams = {
templates?: RelevantSortTemplates;
};

type RelevantSortWidget = WidgetFactory<
export type RelevantSortWidget = WidgetFactory<
RelevantSortWidgetDescription & { $$widgetType: 'ais.relevantSort' },
RelevantSortConnectorParams,
RelevantSortWidgetParams
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/voice-search/voice-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export type VoiceSearchWidgetParams = {
createVoiceSearchHelper?: CreateVoiceSearchHelper;
};

type VoiceSearch = WidgetFactory<
export type VoiceSearchWidget = WidgetFactory<
VoiceSearchWidgetDescription & { $$type: 'ais.voiceSearch' },
VoiceSearchConnectorParams,
VoiceSearchWidgetParams
Expand Down Expand Up @@ -89,7 +89,7 @@ const renderer = ({
);
};

const voiceSearch: VoiceSearch = widgetParams => {
const voiceSearch: VoiceSearchWidget = widgetParams => {
const {
container,
cssClasses: userCssClasses = {},
Expand Down

0 comments on commit e9764e9

Please sign in to comment.