Skip to content

improve(tests): Replace no-explicit-any fallbacks#3235

Open
nicholaspai wants to merge 2 commits into
masterfrom
remove-any-tests
Open

improve(tests): Replace no-explicit-any fallbacks#3235
nicholaspai wants to merge 2 commits into
masterfrom
remove-any-tests

Conversation

@nicholaspai
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +10 to +15
type OftAdapterInternals = OftAdapter & {
initialized: boolean;
_redisGetPendingBridgesPreDeposit: (account: EvmAddress) => Promise<string[]>;
_getOftStatus: (txHash: string) => Promise<string | undefined>;
_redisGetOrderDetails: (cloid: string, account: EvmAddress) => Promise<OrderDetails>;
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +35 to +36
const l2Bridge = adapter.l2Bridge as typeof adapter.l2Bridge & {
queryFilter: () => Promise<OftSentEvent[]>;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@pxrl pxrl requested a review from dijanin-brat as a code owner April 21, 2026 10:07
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.

2 participants