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

Clarify input to Fuse.parseIndex #782

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

dbaynard
Copy link

@dbaynard dbaynard commented Oct 16, 2024

It is not obvious how to use Fuse.parseInput, and if supplied an incorrect argument it errs, silently.

  1. Narrowing the type clarifies intent (in code and in editor integrations).
  2. Documentation gives a further clarifying example.

This fixes the issues that led to #524 and #624 and my losing more time than I'd have liked on this otherwise excellent library!

I'm Creating as a draft because it doesn't yet meet contributing guidelines.

Narrowing the type of the parameter from `any` makes it obvious that the
input is an `Object`, rather than a `String`.

With the `any` type as input, it was not obvious how to use this
function.

See krisk#524 and krisk#624 for people bitten by this.
This takes a javascript `Object`, not a `String`. The difference is
relevant when loading a pre-computed index using a web request, for
example, or when deserializing from OPFS (not shown).
@dbaynard dbaynard marked this pull request as ready for review October 17, 2024 13:27
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.

1 participant