Skip to content

Commit

Permalink
fix(typescript): clarify input to parseIndex
Browse files Browse the repository at this point in the history
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 #524 and #624 for people bitten by this.
  • Loading branch information
dbaynard authored and krisk committed Feb 3, 2025
1 parent 4e30d3e commit 72b6e25
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ declare class Fuse<T> {
): FuseIndex<U>

public static parseIndex<U>(
index: any,
index: {
keys: ReadonlyArray<string>
records: FuseIndexRecords
},
options?: FuseIndexOptions<U>
): FuseIndex<U>

Expand Down

0 comments on commit 72b6e25

Please sign in to comment.