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(store,world): minor config validation fixes #2517

Merged
merged 10 commits into from
Mar 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(store): allow passing constant enum to config
alvrs committed Mar 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit a95f2888451da4303eb3588c8e6f9069d826ec66
2 changes: 1 addition & 1 deletion packages/store/package.json
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@
"test:ci": "pnpm run test"
},
"dependencies": {
"@arktype/util": "0.0.25",
"@arktype/util": "0.0.27",
"@latticexyz/common": "workspace:*",
"@latticexyz/config": "workspace:*",
"@latticexyz/protocol-parser": "workspace:*",
2 changes: 1 addition & 1 deletion packages/store/ts/config/v2/input.ts
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ export type StoreInput = {
export type TableShorthandInput = SchemaInput | string;

export type TablesWithShorthandsInput = {
[key: string]: TableInput | TableShorthandInput;
readonly [key: string]: TableInput | TableShorthandInput;
};

export type StoreWithShorthandsInput = Omit<StoreInput, "tables"> & { tables: TablesWithShorthandsInput };
8 changes: 8 additions & 0 deletions packages/store/ts/config/v2/store.test.ts
Original file line number Diff line number Diff line change
@@ -495,4 +495,12 @@ describe("defineStore", () => {
}),
).throwsAndHasTypeError("Overrides of `name` and `namespace` are not allowed for tables in a store config");
});

it("should allow const enum as input", () => {
const enums = {
Example: ["First", "Second"],
} as const;

defineStore({ enums });
});
Copy link
Member

Choose a reason for hiding this comment

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

cc @0xhank

});
2 changes: 1 addition & 1 deletion packages/world/package.json
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@
"test:ci": "pnpm run test"
},
"dependencies": {
"@arktype/util": "0.0.25",
"@arktype/util": "0.0.27",
"@latticexyz/common": "workspace:*",
"@latticexyz/config": "workspace:*",
"@latticexyz/schema-type": "workspace:*",
28 changes: 6 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.