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

fix(typescript): fieldNormWeight should be optional, fixes #650 #648

Closed
wants to merge 2 commits into from

Conversation

BenJenkinson
Copy link
Contributor

@BenJenkinson BenJenkinson commented May 3, 2022

The fieldNormWeight config option has a default value of 1, and can therefore be optional (like the other config options)

Fuse/src/core/config.js

Lines 58 to 59 in a9e0080

// The weight to determine how much field length norm effects scoring.
fieldNormWeight: 1

Related issues

Was this a regression?

  • Omitting fieldNormWeight was valid in <= 6.5.3 (though only because it was missing from the type definition), and is now unnecessarily required in 6.6.0

The `fieldNormWeight` config option has a default value of `1`, and can therefore be optional (like the other config options)

https://github.com/krisk/Fuse/blob/a9e00804497a1bfd7a94040520417825c085c945/src/core/config.js#L58-L59
@huzaifahj
Copy link

Created a duplicate pull request before finding this one. Agreed!

@BenJenkinson
Copy link
Contributor Author

This would fix #650

@KoltesDigital
Copy link

Haha I was also too hurried.

I repeat here for the maintainers: FYI you may be interested in built-in Partial type to automatically flag all properties to be optional.

BenJenkinson added a commit to BenJenkinson/Fuse that referenced this pull request May 5, 2022
### Changes
- **Make `FuseOptionKeyObject.weight` property optional (and add description taken from docs)**
- **Add `FuseOptionKeyObject.getFn` property (and add description taken from docs)**
- Add `FuseOptionKeyObjectGetFunction` type to match existing `FuseGetFunction` type
- Make `FuseOptionKeyObject` a generic, to allow typing the `getFn` method argument
- Make `FuseOptionKey` a generic, to allow making `FuseOptionKeyObject` a generic
- Convert some existing inline comments `// foo` to jsdoc comments `/** foo */` so they will be included in intellisense

### Related issues
- Fixes krisk#655

### See also
- PR krisk#648
@BenJenkinson BenJenkinson changed the title Fix type definition, fieldNormWeight should be optional fix(typescript): fieldNormWeight should be optional May 5, 2022
@BenJenkinson BenJenkinson changed the title fix(typescript): fieldNormWeight should be optional fix(typescript): fieldNormWeight should be optional, fixes #650 May 5, 2022
@krisk
Copy link
Owner

krisk commented May 6, 2022

Fixed in latest.

@krisk krisk closed this May 6, 2022
@BenJenkinson BenJenkinson deleted the patch-1 branch June 8, 2022 17:31
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.

[Typescript] fieldNormWeight is non-optional
4 participants