Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ts): make template types consistent #4785

Merged
merged 14 commits into from
Jul 5, 2021
Merged

fix(ts): make template types consistent #4785

merged 14 commits into from
Jul 5, 2021

Conversation

shortcuts
Copy link
Member

Summary

Follow up of #4774

In some cases, we were exporting our Templates types as required for our widgets, while they are in reality optional and partial.

To avoid our users to provide extra logic over our types and to keep it consistent with our usage, the types are now:

  • Exported as optional in the widget.
  • Export as required in the component.

Result

The exported types are now correct.

Ticket

DX-1778

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 16, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 855a38d:

Sandbox Source
InstantSearch.js Configuration

@shortcuts shortcuts marked this pull request as ready for review June 17, 2021 07:43
@shortcuts shortcuts requested review from a team, tkrugg and francoischalifour and removed request for a team June 17, 2021 07:43
src/components/RefinementList/RefinementList.tsx Outdated Show resolved Hide resolved
src/components/RefinementList/RefinementList.tsx Outdated Show resolved Hide resolved
src/widgets/answers/answers.tsx Show resolved Hide resolved
src/widgets/geo-search/geo-search.ts Show resolved Hide resolved
src/widgets/refinement-list/refinement-list.tsx Outdated Show resolved Hide resolved
src/widgets/refinement-list/refinement-list.tsx Outdated Show resolved Hide resolved
src/widgets/refinement-list/refinement-list.tsx Outdated Show resolved Hide resolved
src/widgets/stats/stats.tsx Outdated Show resolved Hide resolved
@shortcuts shortcuts requested a review from Haroenv June 28, 2021 11:39
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall almost good to merge, although the Partial<{...}> should probably be stacked + deciding what to do with spreading defaultTemplates or equaling to defaultTemplates

src/components/RefinementList/RefinementList.tsx Outdated Show resolved Hide resolved
src/widgets/answers/answers.tsx Show resolved Hide resolved
src/widgets/menu-select/menu-select.tsx Outdated Show resolved Hide resolved
src/widgets/refinement-list/refinement-list.tsx Outdated Show resolved Hide resolved
src/widgets/refinement-list/refinement-list.tsx Outdated Show resolved Hide resolved
src/widgets/sort-by/sort-by.tsx Show resolved Hide resolved
src/widgets/toggle-refinement/toggle-refinement.tsx Outdated Show resolved Hide resolved
@Haroenv Haroenv changed the title fix(ts): make templates types consistent fix(ts): make template types consistent Jun 29, 2021
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all right, this is a great effort! let's still do a global search for userTemplates and avoid it wherever the templates get prepared after :)

src/widgets/answers/answers.tsx Show resolved Hide resolved
src/widgets/breadcrumb/breadcrumb.tsx Outdated Show resolved Hide resolved
src/widgets/clear-refinements/clear-refinements.tsx Outdated Show resolved Hide resolved
src/widgets/hierarchical-menu/hierarchical-menu.tsx Outdated Show resolved Hide resolved
src/widgets/hits/__tests__/defaultTemplates-test.ts Outdated Show resolved Hide resolved
src/widgets/numeric-menu/numeric-menu.tsx Outdated Show resolved Hide resolved
src/widgets/rating-menu/rating-menu.tsx Outdated Show resolved Hide resolved
src/widgets/search-box/defaultTemplates.ts Outdated Show resolved Hide resolved
src/widgets/toggle-refinement/toggle-refinement.tsx Outdated Show resolved Hide resolved
src/widgets/voice-search/voice-search.tsx Show resolved Hide resolved
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect!

@tkrugg tkrugg removed their request for review July 2, 2021 10:32
@Haroenv Haroenv merged commit e0fbd55 into master Jul 5, 2021
@Haroenv Haroenv deleted the fix/ts-templates branch July 5, 2021 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants