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

feat(store,world): usable enum values from config #2807

Merged
merged 11 commits into from
May 14, 2024
Merged

Conversation

holic
Copy link
Member

@holic holic commented May 9, 2024

transforms enum input arrays into an object so they can be used in TS

closes #1957

Copy link

changeset-bot bot commented May 9, 2024

🦋 Changeset detected

Latest commit: 668b3d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@latticexyz/store Patch
@latticexyz/world Patch
@latticexyz/cli Patch
@latticexyz/dev-tools Patch
@latticexyz/query Patch
@latticexyz/react Patch
@latticexyz/store-indexer Patch
@latticexyz/store-sync Patch
@latticexyz/world-modules Patch
mock-game-contracts Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/protocol-parser Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
@latticexyz/services Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@holic holic marked this pull request as ready for review May 9, 2024 17:30
@holic holic requested review from alvrs and yonadaaa as code owners May 9, 2024 17:30
@holic holic changed the title feat(store,world): translate enums feat(store,world): usable enums from config May 9, 2024
@alvrs
Copy link
Member

alvrs commented May 10, 2024

i very much like the new feature but is there any way we could turn this into a non-breaking change? maybe as a new property on the output? there might be teams out there using the current structure

writeContract({
// …
functionName: "setTerrainType",
args: [config.mappedEnums.TerrainType.Grass],
Copy link
Member Author

@holic holic May 10, 2024

Choose a reason for hiding this comment

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

Suggested change
args: [config.mappedEnums.TerrainType.Grass],
args: [config.enumValues.TerrainType.Grass],

I can't decide which 🤔

decided on enumValues

@holic holic changed the title feat(store,world): usable enums from config feat(store,world): usable enum values from config May 10, 2024
alvrs
alvrs previously approved these changes May 14, 2024
@holic holic merged commit 27f888c into main May 14, 2024
11 of 12 checks passed
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.

config should return enums as a usable TS object
2 participants