Skip to content

Commit 7c5a3e6

Browse files
Copilotna-trium-144
andcommitted
Improve type safety in promise tracking
- Use 'unknown' instead of 'any' for reject function parameter - Use Error object instead of string for worker interruption error - Better adherence to TypeScript best practices Co-authored-by: na-trium-144 <[email protected]>
1 parent a31f8bb commit 7c5a3e6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/terminal/worker/runtime.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ export function WorkerProvider({
5757
const commandHistory = useRef<string[]>([]);
5858

5959
// Track pending promises for restart-based interruption
60-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
61-
const pendingPromises = useRef<Set<(reason: any) => void>>(new Set());
60+
const pendingPromises = useRef<Set<(reason: unknown) => void>>(new Set());
6261

6362
const initializeWorker = useCallback(async () => {
6463
if (!mutex.isLocked()) {
@@ -152,7 +151,7 @@ export function WorkerProvider({
152151
break;
153152
case "restart": {
154153
// Reject all pending promises
155-
const error = "Worker interrupted";
154+
const error = new Error("Worker interrupted");
156155
pendingPromises.current.forEach((reject) => reject(error));
157156
pendingPromises.current.clear();
158157

0 commit comments

Comments
 (0)