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(plugin-match-highlight): SearchResultWithHighlight type improvement #514

Merged

Conversation

fturmel
Copy link
Contributor

@fturmel fturmel commented Oct 9, 2023

The current way the SearchResultWithHighlight type is constructed ends up losing type info if you use an array method to iterate over hits. I made a TypeScript playground demo to demonstrate the issue.

Current state:

Screenshot 2023-10-08 at 11 37 04 PM

Proposed solution in this PR:

Screenshot 2023-10-08 at 11 36 24 PM

@vercel
Copy link

vercel bot commented Oct 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orama-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 3:49am

Copy link
Member

@micheleriva micheleriva left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@micheleriva micheleriva merged commit 66c54aa into oramasearch:main Oct 11, 2023
2 checks passed
@fturmel fturmel deleted the PR/resultwithhighlight-type-improvement branch October 20, 2023 16:17
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.

2 participants