fix(bugcollect): HttpInterceptor 用 globalThis 替代 global,修复消费端 TS 找不到 global
BugCollect.startCapture 自动启用 HttpInterceptor 后,该文件进入消费端类型检查图; 部分 RN 工程 tsconfig 未提供 `global` 类型,改用 globalThis(可移植)。 Co-Authored-By: Claude <noreply@anthropic.com>
这个提交包含在:
父节点
4d2b834f96
当前提交
4d5adf447a
@ -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<Response> => {
|
||||
@ -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
|
||||
}
|
||||
},
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户