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

Typed hits property in search method #21

Merged
merged 10 commits into from
Jul 17, 2022
Merged

Typed hits property in search method #21

merged 10 commits into from
Jul 17, 2022

Conversation

DanieleFedeli
Copy link
Contributor

This PR aims to avoid the assertion of a type when handling the result object.

@@ -129,7 +135,7 @@ export class Lyra<TSchema extends PropertiesSchema = PropertiesSchema> {
break;
}

const fullDoc = this.docs.get(id);
const fullDoc = this.docs.get(id)!;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@micheleriva Is there a better way to do that? I hate asserting non-null

Copy link
Member

Choose a reason for hiding this comment

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

mmm afaik this is the only way... if there's a guarantee that the value exists, it's not that bad

@micheleriva micheleriva merged commit 971d773 into oramasearch:main Jul 17, 2022
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