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

Make DimItem#itemCategoryHashes type be ItemCategoryHash #10728

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

bhollis
Copy link
Contributor

@bhollis bhollis commented Sep 16, 2024

It seemed like it would be nice for DimItem#itemCategoryHashes to actually be typed ItemCategoryHash[]. TS is weirdly loose about this - it doesn't catch the special inverted item category hashes we use (e.g. for grenade launchers) but it's still an improvement.

@@ -45,7 +46,7 @@ describe('vaultWeaponGroupingSelector', () => {
{
...firstItem,
typeName: undefined as unknown as string,
itemCategoryHashes: [0],
itemCategoryHashes: [0 as ItemCategoryHashes],
Copy link
Contributor

@FlaminSarge FlaminSarge Sep 16, 2024

Choose a reason for hiding this comment

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

Do we have an ItemCategoryHash.Invalid def we can use instead of 0 for any of the places we're using/comparing to 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No - this test is intentionally using an invalid hash for some reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, in that case it should be undefined, not zero. It's modeling the absence of a hash, not a special invalid hash.

@bhollis bhollis merged commit 7b96421 into master Sep 17, 2024
7 checks passed
@bhollis bhollis deleted the item-category-hash-type branch September 17, 2024 17:32
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