Yicong-Huang opened a new issue, #4867:
URL: https://github.com/apache/texera/issues/4867
### Task Summary
Replace the remaining `any` type annotations and `as any` casts in spec
files with proper `Mocked<T>` types. This finishes type-tightening work that PR
#4862 partially landed (31 sites tightened in active specs; ~80 remain in
currently-excluded specs and a handful in active specs that were pre-existing).
### Why deferred
When the migration sweep replaced `jasmine.SpyObj<T>` with `Mocked<T>`,
Vitest's strict typing rejected the partial-mock object literal pattern these
specs use. The pragmatic shortcut was to loosen to `any`. The clean form is:
```ts
let svc: Mocked<XService>;
beforeEach(() => {
svc = { method1: vi.fn() } as unknown as Mocked<XService>;
// — or —
svc = TestBed.inject(XService) as unknown as Mocked<XService>;
});
// svc.method1.mockReturnValue(...) → fully typed
```
The `TestBed.inject(...) as any` form was already swept (PR #4862, commit
ad0433c4). Remaining cases are inline mock object literals where the target
service type isn't immediately obvious from a single-line regex — needs
per-spec attention.
### Two ways to approach
**A. Per-spec sweep** during the follow-ups that re-enable each excluded
spec (#4864, #4865). Each one of those PRs touches the affected file anyway and
can tighten types as it goes.
**B. Standalone cleanup PR** that doesn't change behavior, just types.
**Recommendation**: A — fold this into the natural unblocking PRs so the
type-tightening lands alongside the compile-fix. Keep this issue open as a
checklist; close once all `any` introduced by the migration is gone.
### Out of scope
Pre-existing `any` patterns NOT introduced by the migration:
- `(component as any).privateField` — accessing private members
- `as any as joint.dia.Link` — partial-mock to JointJS types
These predate the migration and should be tightened (or replaced with `//
@ts-expect-error` where genuinely needed) in a separate cleanup, not as part of
this issue.
### Tracking
- Predecessor: #4863
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]