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

/weakness: Add fuzzy matching #10316

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bingingem
Copy link
Contributor

https://www.smogon.com/forums/threads/support-fuzzy-searching-in-weak.3731963/

This is based on work done by @earljoves in #9929 - I expanded it to include type matching

const type1 = dex.types.get(targets[0]);
const type2 = dex.types.get(targets[1]);
const type3 = dex.types.get(targets[2]);
let type1: any = dex.types.get(targets[0]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let type1: any = dex.types.get(targets[0]);
let type1 = dex.types.get(targets[0]);

This shouldn't need to be any. Let TypeScript infer it - will allow for better error catching.

Copy link
Contributor Author

@bingingem bingingem Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I also removed the explicit typing from the species declaration as well. Let me know if you'd prefer it the other way. Thanks for the feedback!

Edit: I'm getting some lint errors and I think that's why I added the any in the first place (I think in this commit). I'll look into how that's working with the dex functions and try and resolve it soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the linting issues by looping through the species types instead of adding them as an array. Let me know if there's a better way to accomplish that or if there's anything else I can do. Thanks!

@KrisXV KrisXV changed the title Weakness: add fuzzy matching to command Weakness: Add fuzzy matching to command Aug 6, 2024
@KrisXV KrisXV changed the title Weakness: Add fuzzy matching to command /weakness: Add fuzzy matching Aug 6, 2024
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.

2 participants