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, ) => {