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:
parent
8fa7c14f18
commit
956ec96d51
|
@ -30,8 +30,8 @@ export function fetch(url: string, options?: RequestInit): Promise<Response> {
|
||||||
headers: _headers = {},
|
headers: _headers = {},
|
||||||
body = [],
|
body = [],
|
||||||
} = options || {};
|
} = options || {};
|
||||||
let unlisten: Function | undefined;
|
let unlisten: (() => void) | undefined;
|
||||||
let setRequestId: Function | undefined;
|
let setRequestId: ((value: number) => void) | undefined;
|
||||||
const requestIdPromise = new Promise((resolve) => (setRequestId = resolve));
|
const requestIdPromise = new Promise((resolve) => (setRequestId = resolve));
|
||||||
const ts = new TransformStream();
|
const ts = new TransformStream();
|
||||||
const writer = ts.writable.getWriter();
|
const writer = ts.writable.getWriter();
|
||||||
|
@ -66,7 +66,7 @@ export function fetch(url: string, options?: RequestInit): Promise<Response> {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
).then((u: Function) => (unlisten = u));
|
).then((u: () => void) => (unlisten = u));
|
||||||
|
|
||||||
const headers: Record<string, string> = {
|
const headers: Record<string, string> = {
|
||||||
Accept: "application/json, text/plain, */*",
|
Accept: "application/json, text/plain, */*",
|
||||||
|
|
Loading…
Reference in New Issue