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
This commit is contained in:
Mihail Klimin 2025-03-16 12:03:49 +03:00
parent 8fa7c14f18
commit 956ec96d51
1 changed files with 3 additions and 3 deletions

View File

@ -30,8 +30,8 @@ export function fetch(url: string, options?: RequestInit): Promise<Response> {
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<Response> {
close();
}
}),
).then((u: Function) => (unlisten = u));
).then((u: () => void) => (unlisten = u));
const headers: Record<string, string> = {
Accept: "application/json, text/plain, */*",