-
-
Notifications
You must be signed in to change notification settings - Fork 804
Labels
Description
The FuseOptionKeyObject type definition doesn't match the implementation.
Lines 234 to 239 in 6afcfaf
| export type FuseOptionKeyObject = { | |
| name: string | string[] | |
| weight: number | |
| } | |
| export type FuseOptionKey = FuseOptionKeyObject | string | string[] |
-
The
weightproperty may be optional. (Since if not specified, Fuse will default it to1)
Lines 59 to 65 in 6afcfaf
| if (hasOwn.call(key, 'weight')) { | |
| weight = key.weight | |
| if (weight <= 0) { | |
| throw new Error(ErrorMsg.INVALID_KEY_WEIGHT_VALUE(name)) | |
| } | |
| } |
-
The
getFnproperty is missing.
Lines 170 to 180 in 6afcfaf
| const options = { | |
| includeScore: true, | |
| keys: [ | |
| { name: 'title', getFn: (book) => book.title }, | |
| { name: 'authorName', getFn: (book) => book.author.name } | |
| ] | |
| }) | |
| const fuse = new Fuse(list, options) | |
| const result = fuse.search({ authorName: 'Steve' }) |
Version
6.6.0
Is this a regression?
No
🔬Minimal Reproduction (in Typescript)
- The
weightproperty cannot be omitted without an error. - The
getFnexample from the docs cannot be written without an error.
Reactions are currently unavailable