Fuse.search doesn't return only T[]
See original GitHub issueCurrent TS definition says,
search(pattern: string): T[]
But with includeScore
, the search returns:
search(pattern: string): T[] | { item: T, score: number }[];
For now, I am ignoring the return type with // @ts-ignore
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Not getting any results back from Fuse.js with Vue
my keys are populated properly and the only issue is that results doesn't return anything.
Read more >Options | Fuse.js
The default options only search the first 60 characters. This should suffice if it is reasonably expected that the match is within this...
Read more >How to Add Search to a React App with Fuse.js - freeCodeCamp
Step 0: Bootstrapping our app; Step 1: Installing Fuse.js; Step 2: Creating a new Fuse search instance; Step 3: Setting up dynamic search ......
Read more >Autocomplete with fuzzy search and Fuse.js | Academy
A simple way to add autocomplete to an input element is to use a <datalist> . This doesn't even require any JavaScript, just...
Read more >CS135 FUSE Documentation
If you aren't using file handles, this function should just check for existence and permissions and return either success or an error code....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is more:
with
id
search(pattern: string): string[];
with
includeMatches
search(pattern: string): { item: T; matches: any; }[];
with
id
andincludeMatches
search(pattern: string): { item: string; matches: any; }[];
its really ugly but modifying the definition file like this seems to work
@william-lohan thank you! 👍 Following your example, I got it working like so:
There are two important limitations:
Fuse.FuseOptions
cannot be used and the options object has to be inlined. For example, the following doesn’t work:Anyway, I believe the initial issue has been fixed and can be closed.