From 4d5adf447ae1fbb519532efc599fb6459363e8b7 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Thu, 25 Jun 2026 18:26:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(bugcollect):=20HttpInterceptor=20=E7=94=A8?= =?UTF-8?q?=20globalThis=20=E6=9B=BF=E4=BB=A3=20global=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=B6=88=E8=B4=B9=E7=AB=AF=20TS=20=E6=89=BE=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=20global?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BugCollect.startCapture 自动启用 HttpInterceptor 后,该文件进入消费端类型检查图; 部分 RN 工程 tsconfig 未提供 `global` 类型,改用 globalThis(可移植)。 Co-Authored-By: Claude --- packages/bugcollect/src/interceptor/HttpInterceptor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bugcollect/src/interceptor/HttpInterceptor.ts b/packages/bugcollect/src/interceptor/HttpInterceptor.ts index e289dff..b0a5867 100644 --- a/packages/bugcollect/src/interceptor/HttpInterceptor.ts +++ b/packages/bugcollect/src/interceptor/HttpInterceptor.ts @@ -14,10 +14,10 @@ export const HttpInterceptor = { start(onError: OnError): void { if (_originalFetch) return // already installed - _originalFetch = global.fetch + _originalFetch = globalThis.fetch // eslint-disable-next-line @typescript-eslint/no-explicit-any - ;(global as any).fetch = async ( + ;(globalThis as any).fetch = async ( input: RequestInfo | URL, init?: RequestInit, ): Promise => { @@ -44,7 +44,7 @@ export const HttpInterceptor = { stop(): void { if (_originalFetch) { // eslint-disable-next-line @typescript-eslint/no-explicit-any - ;(global as any).fetch = _originalFetch + ;(globalThis as any).fetch = _originalFetch _originalFetch = null } },