refactor: replace all any types with specific types#343
Open
its-applekid wants to merge 4 commits into
Open
Conversation
- GuardrailWallet contract with allowlists and spending limits - Mock contracts (USDC, Morpho vault, Chainlink oracle) - Comprehensive gas tests measuring overhead - Results: ~96k gas overhead (+104%) with allowlist + spending limits - Confirmed O(1) allowlist lookups (100 contracts = same cost as 2) - Oracle read: 10k gas (mock), expect 40-50k in production
Replace 'any' with specific types in lend and service source files: - lend/providers/aave/sdk.ts: typed formattedReserve parameter - lend/providers/morpho/api.ts: defined Morpho GraphQL response types - lend/providers/morpho/sdk.ts: typed vault and allocation parameters - services/__mocks__/MockChainManager.ts: use 'as unknown as T' pattern 41 → 28 remaining any types
Replace 'any' with specific types in test and mock files using patterns: - Mocks: use 'as unknown as SpecificType' for mock objects - Error handling: NodeJS.ErrnoException for spawn errors - Custom RPC methods: eslint-disable for anvil methods (unavoidable) - Test utilities: type specific viem client/account returns - Unsupported chain testing: eslint-disable for intentional invalid types All 47 test files pass, 0 no-explicit-any warnings, typecheck clean
👷 Deploy request for actions-ui pending review.Visit the deploys page to approve it
|
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces 41 occurrences of
anytype with specific, properly-typed alternatives across 13 SDK files and 5 mock/test files. Follows TypeScript best practices with proper type safety patterns.Changes
Source Files (4 files):
Test/Mock Files (9 files):
as unknown as SpecificTypefor mock objectsNodeJS.ErrnoExceptionfor spawn errorsVerification
✅ All 47 test files pass (339 tests, 10 skipped)
✅ 0
no-explicit-anywarnings✅ TypeScript strict mode passes
✅ No behavioral changes — purely typing
Notes
Anvil impersonate/stop methods and intentional invalid chain tests keep
as anywith eslint-disable comments since those are legitimate exceptions (unavoidable due to viem's typed interface vs Anvil's custom RPC methods).Closes #337