mirror of
				https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
				synced 2025-11-04 16:23:41 +08:00 
			
		
		
		
	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:
		@@ -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, */*",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user