From 956ec96d51de9b4988100bf99be0ee53f81b7888 Mon Sep 17 00:00:00 2001 From: Mihail Klimin Date: Sun, 16 Mar 2025 12:03:49 +0300 Subject: [PATCH] fix(types): improve typings in stream.ts - Replace generic Function type with specific () => void for unlisten - Enhance typing for setRequestId from Function to ((value: number) => void) - Address code review feedback from Biome linter --- app/utils/stream.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/utils/stream.ts b/app/utils/stream.ts index 900abb6e4..323e540bc 100644 --- a/app/utils/stream.ts +++ b/app/utils/stream.ts @@ -30,8 +30,8 @@ export function fetch(url: string, options?: RequestInit): Promise { headers: _headers = {}, body = [], } = options || {}; - let unlisten: Function | undefined; - let setRequestId: Function | undefined; + let unlisten: (() => void) | undefined; + let setRequestId: ((value: number) => void) | undefined; const requestIdPromise = new Promise((resolve) => (setRequestId = resolve)); const ts = new TransformStream(); const writer = ts.writable.getWriter(); @@ -66,7 +66,7 @@ export function fetch(url: string, options?: RequestInit): Promise { close(); } }), - ).then((u: Function) => (unlisten = u)); + ).then((u: () => void) => (unlisten = u)); const headers: Record = { Accept: "application/json, text/plain, */*",