improve(tests): Replace no-explicit-any fallbacks#3235
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14ac9c7621
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| type Constructor<T = EVMSpokePoolClient> = new (...args: any[]) => T; | ||
| type Constructor<T = EVMSpokePoolClient> = new (...args: unknown[]) => T; |
There was a problem hiding this comment.
Restore any[] in mixin constructor alias
Changing the constructor alias to new (...args: unknown[]) breaks TypeScript’s mixin constraint for classes extended via helper functions, so _MockSpokeListener no longer type-checks (TS2545 in this file during yarn build:test). This regression makes the test module uncompilable under strict type checking; the mixin constructor rest parameter needs to stay any[].
Useful? React with 👍 / 👎.
| type OftAdapterInternals = OftAdapter & { | ||
| initialized: boolean; | ||
| _redisGetPendingBridgesPreDeposit: (account: EvmAddress) => Promise<string[]>; | ||
| _getOftStatus: (txHash: string) => Promise<string | undefined>; | ||
| _redisGetOrderDetails: (cloid: string, account: EvmAddress) => Promise<OrderDetails>; | ||
| }; |
There was a problem hiding this comment.
Use structural internals types for adapter test hooks
Intersecting OftAdapter/CctpAdapter with mocked private internals in OftAdapterInternals and CctpAdapterInternals causes the cast result to collapse to never in this file, which then produces TS2339 for all internals.* assignments in the tests. That means this test no longer type-checks; a standalone structural interface for mocked members avoids the class-private intersection issue.
Useful? React with 👍 / 👎.
| const l2Bridge = adapter.l2Bridge as typeof adapter.l2Bridge & { | ||
| queryFilter: () => Promise<OftSentEvent[]>; |
There was a problem hiding this comment.
Avoid typed access to protected bridge members
The new stubbing pattern reads adapter.l2Bridge/adapter.l1Bridge directly, but those members are protected on BaseL2BridgeAdapter; this introduces TS2445 errors and prevents the test from compiling in strict type-check runs. The stub should avoid protected-member access at the type level (or use a dedicated test helper) to keep the file type-safe.
Useful? React with 👍 / 👎.
No description provided.