Skip to content

fix(ci): resolve TS2742 type error blocking all PRs#17393

Open
miloudbelarebia wants to merge 1 commit intoopenclaw:mainfrom
miloudbelarebia:fix/ci-ts2742-and-oom
Open

fix(ci): resolve TS2742 type error blocking all PRs#17393
miloudbelarebia wants to merge 1 commit intoopenclaw:mainfrom
miloudbelarebia:fix/ci-ts2742-and-oom

Conversation

@miloudbelarebia
Copy link
Contributor

@miloudbelarebia miloudbelarebia commented Feb 15, 2026

Summary

  • Fix TS2742 error in src/slack/monitor/slash.test-harness.ts that blocks the check job (pnpm tsgo) on all pull requests
  • Replace ReturnType<typeof vi.fn> with MockInstance (directly exported by vitest) to resolve the non-portable type reference to .pnpm/@[email protected]/...

Root Cause

The getSlackSlashMocks() function is exported, so TypeScript needs to generate a portable type definition. ReturnType<typeof vi.fn> resolves to an internal vitest type at a .pnpm/ path that TypeScript cannot reference portably, triggering TS2742.

MockInstance is the proper public type exported by vitest for mock functions and provides the exact same type contract.

Impact

Critical — This error currently blocks the check CI job on every PR in the repository.

Closes #17315

Note on #17341 (OOM)

The CI OOM crash (issue #17341) requires adding NODE_OPTIONS: --max-old-space-size=4096 to the Ubuntu checks job in .github/workflows/ci.yml. This change needs the workflow token scope and couldn't be included in this PR. The fix is documented in the issue — a maintainer with write access can apply it (2-line change matching the existing Windows/macOS configuration).

Local Validation

  • pnpm check (tsgo): ✅ passes — this is the exact job this PR fixes
  • pnpm test: N/A — type-only change, no runtime behavior affected
  • Formatting: verified with oxfmt --check

Scope

Single-file, single-concern: one type annotation change in src/slack/monitor/slash.test-harness.ts. No functional or behavioral changes.

AI Assistance

AI-assisted (Claude Code) for codebase exploration and drafting. The root cause analysis (identifying TS2742 caused by non-portable .pnpm/ path in exported function return type), the fix approach (replacing ReturnType<typeof vi.fn> with MockInstance), and verification are my own work.

Testing level: Fully tested — confirmed pnpm check passes locally and CI check job passes.

Test plan

  • CI check job passes (tsgo no longer errors on this file)
  • Existing Slack slash command tests still pass
  • No functional change — MockInstance is the same type as ReturnType<typeof vi.fn>

Greptile Summary

Fixes a TS2742 type error in src/slack/monitor/slash.test-harness.ts that was blocking the check CI job (pnpm tsgo) on all PRs. The fix replaces ReturnType<typeof vi.fn> with vitest's publicly exported MockInstance type in the SlashHarnessMocks type definition.

  • ReturnType<typeof vi.fn> resolved to an internal vitest type at a .pnpm/ path that TypeScript cannot reference portably in declaration output, triggering TS2742 on the exported getSlackSlashMocks() function
  • MockInstance is the correct public API type from vitest for mock function instances, and is already used in other test helpers in this codebase (e.g., audio.test-helpers.ts)
  • This is a type-only change with no runtime behavioral impact
  • No other files in the codebase have ReturnType<typeof vi.fn> in exported contexts, so this is the only instance of the issue

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, type-only fix with no runtime impact.
  • Single-file, type-annotation-only change replacing a non-portable type alias with vitest's official public export. The MockInstance type is already used elsewhere in the codebase, confirming it's an established pattern. No runtime behavior changes, no logic changes, no new dependencies. The root cause analysis is sound (TS2742 from exported function with non-portable return type).
  • No files require special attention.

Last reviewed commit: caad89a

Replace `ReturnType<typeof vi.fn>` with `MockInstance` from vitest.

The inferred type referenced a non-portable internal path
(.pnpm/@vitest[email protected]/node_modules/@vitest/spy) that TypeScript
could not resolve when exporting the function. `MockInstance` is
directly exported by vitest and provides the same type contract.

This error blocks the `check` job (tsgo) on all pull requests.

Closes openclaw#17315

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CI check job failing on all PRs — TS2742 in slash.test-harness.ts

2 participants

Comments