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 {
|
start(onError: OnError): void {
|
||||||
if (_originalFetch) return // already installed
|
if (_originalFetch) return // already installed
|
||||||
|
|
||||||
_originalFetch = global.fetch
|
_originalFetch = globalThis.fetch
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
;(global as any).fetch = async (
|
;(globalThis as any).fetch = async (
|
||||||
input: RequestInfo | URL,
|
input: RequestInfo | URL,
|
||||||
init?: RequestInit,
|
init?: RequestInit,
|
||||||
): Promise<Response> => {
|
): Promise<Response> => {
|
||||||
@ -44,7 +44,7 @@ export const HttpInterceptor = {
|
|||||||
stop(): void {
|
stop(): void {
|
||||||
if (_originalFetch) {
|
if (_originalFetch) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
;(global as any).fetch = _originalFetch
|
;(globalThis as any).fetch = _originalFetch
|
||||||
_originalFetch = null
|
_originalFetch = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户