Closed qnighy closed 3 years ago
@qnighy @krisk, to resolve the issue where the type is lost and defaults to unknown
, I had to the following - using the minimal reproduction above:
type K = { id: number }
declare const fuse: Fuse<K>;
const matchedIds = fuse.search<K>("").map(res => res.item.id); // <-- notice the type parameter in `search<K>`
This was not the case before and the fix pointed by @qnighy should solve this.
I guess search
(...) was meant to be search(...), using T from the outer Fuse ?
Good catch. Will fix.
Thanks!
Describe the bug
https://github.com/krisk/Fuse/commit/2e60bee242c7b82f0d014a3a35281b34bc6b62fb changed the signature of
Fuse.prototype.search
.Here
T
isn't constrained by any of the arguments. Therefore it defaults tounknown
, making it meaningless.I guess
search<T>(...)
was meant to besearch(...)
, usingT
from the outerFuse<T>
?Version
Fuse 6.4.5
Is this a regression?
Yes. Previously the type parameter was named
R
and was defaulted toT
from the outer classFuse<T>
.🔬Minimal Reproduction
Additional context