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(world): add types for v2 config resolvers #2389

Merged
merged 20 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 13 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
],
"rules": {
"max-len": ["error", { "code": 180, "comments": 180 }]
}
"max-len": ["error", { "code": 180, "comments": 180 }],
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": true,
"types": {
// don't throw an error for the empty object type ({})
"{}": false,
},
},
],
},
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion packages/store/ts/config/v2/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("resolveSchema", () => {
},
} as const;
attest<typeof expected>(resolved).type.toString.snap(
'{ regular: { type: "uint256"; internalType: "uint256"; }; user: { type: "address"; internalType: "CustomType"; }; }',
'{ readonly regular: { readonly type: "uint256"; readonly internalType: "uint256"; }; readonly user: { readonly type: "address"; readonly internalType: "CustomType"; }; }',
);
});

Expand Down
6 changes: 3 additions & 3 deletions packages/store/ts/config/v2/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export type SchemaInput<scope extends AbiTypeScope = AbiTypeScope> = {
};

export type resolveSchema<schema extends SchemaInput<scope>, scope extends AbiTypeScope> = evaluate<{
[key in keyof schema]: {
readonly [key in keyof schema]: {
/** the Solidity primitive ABI type */
type: scope["types"][schema[key]];
readonly type: scope["types"][schema[key]];
/** the user defined type or Solidity primitive ABI type */
internalType: schema[key];
readonly internalType: schema[key];
};
}>;

Expand Down
Loading
Loading