-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug]: tsc check failing on main — vitest spy type inference (TS2742) #16512
Copy link
Copy link
Closed
Description
Summary
The check job (tsc type checking) is consistently failing on main due to vitest spy type inference errors.
Error
error TS2742: The inferred type of 'mockLoadConfig' cannot be named without a reference to
'.pnpm/@[email protected]/node_modules/@vitest/spy'. This is likely not portable.
A type annotation is necessary.
Affected files
src/web/monitor-inbox.test-harness.tssrc/auto-reply/reply.triggers.trigger-handling.test-harness.tssrc/auto-reply/reply/agent-runner.heartbeat-typing.test-harness.tssrc/auto-reply/reply/agent-runner.memory-flush.test-harness.ts
Evidence
- Main branch CI run #22023465143 —
checkjob FAILURE - Recently merged PRs all show the same failure: Fix: Force dashboard command to use localhost URL #16434, security: block apply_patch path traversal outside workspace #16405, Fix: Add type safety to models status command #16395
- The last successful main CI run was #22023532702, subsequent runs all fail
Likely cause
vi.fn() return values in test-harness files lack explicit type annotations. When tsc emits declaration files, it cannot resolve the inferred Mock<...> type without a direct reference to @vitest/spy.
Suggested fix
Add explicit type annotations to the mock variables in test-harness files, e.g.:
import type { Mock } from 'vitest';
const mockLoadConfig: Mock<(...args: any[]) => any> = vi.fn();Or adjust the tsconfig to skip declaration emit for test files.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.