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(types): fixing hits and results types in connectHits and connectInfiniteHits #4820

Merged
merged 2 commits into from
Aug 3, 2021

Conversation

tkrugg
Copy link
Contributor

@tkrugg tkrugg commented Aug 2, 2021

connectHits

The types Hit and AlgoliaHit are mostly the same.

https://github.com/algolia/instantsearch.js/blob/21b6c53d4b1a3f3dd3a2375a5cfe0a31bef6ded6/src/types/results.ts#L60-L63

As of today, the hits exposed via results indeed contain __position and __queryID.

connectInfiniteHits

While trying use InfiniteHitsRenderState in Angular InstantSearch I noticed how hits and results while being part of the state expored byconnectInfiniteHits are not actually visible on the type.

tkrugg added 2 commits August 2, 2021 20:33
The types Hit and AlgoliaHit are mostly the same.

type Hit = {
  __position: number;
  __queryID?: string;
} & AlgoliaHit;

source: https://github.com/algolia/instantsearch.js/blob/21b6c53d4b1a3f3dd3a2375a5cfe0a31bef6ded6/src/types/results.ts#L60-L63

As of today, the hits exposed via results indeed [contain __position and
__queryID](https://github.com/algolia/instantsearch.js/blob/21b6c53d4b1a3f3dd3a2375a5cfe0a31bef6ded6/src/connectors/hits/connectHits.ts#L158).
While trying use `InfiniteHitsRenderState` in Angular InstantSearch I
noticed how `hits` and `results` while being [part of the state expored
by
`connectInfiniteHits`](https://github.com/algolia/instantsearch.js/blob/master/src/connectors/infinite-hits/connectInfiniteHits.ts#L331-L342)
are not actually visible on the type.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 2, 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 f952f03:

Sandbox Source
InstantSearch.js Configuration

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.

looks like this was an oversight!

@Haroenv Haroenv merged commit 2bf987e into master Aug 3, 2021
@Haroenv Haroenv deleted the types/missing-types-infinite-hits branch August 3, 2021 07:22
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.

None yet

2 participants