From 22fd08537a4a603d118e9a7c7a5670d0f61ca38d Mon Sep 17 00:00:00 2001 From: costrict Date: Thu, 16 Apr 2026 15:23:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20fetch.ts=20preconne?= =?UTF-8?q?ct=20=E9=87=8D=E5=A4=8D=E6=A0=87=E8=AF=86=E7=AC=A6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- src/costrict/provider/fetch.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/costrict/provider/fetch.ts b/src/costrict/provider/fetch.ts index dabbf532a..e906a7995 100644 --- a/src/costrict/provider/fetch.ts +++ b/src/costrict/provider/fetch.ts @@ -43,8 +43,13 @@ const VERSION = getVersion() * 3. 注入 Authorization 和 CoStrict 特有 headers * 4. 反应性 401 错误恢复(自动重试一次) */ +type CoStrictFetchFn = { + (input: RequestInfo | URL, init?: RequestInit): Promise + preconnect?: (url: string | URL) => void +} + export function createCoStrictFetch() { - const costrictFetch = async ( + const costrictFetch: CoStrictFetchFn = async ( input: RequestInfo | URL, init?: RequestInit, ) => {