Skip to content

Commit bc24fd5

Browse files
committed
Tighten Live Debugger global hook typing
Replace `any` casts when installing debugger globals with an explicit typed global interface so the runtime stays lint-clean without changing behavior.
1 parent b9da4f3 commit bc24fd5

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • packages/debugger/src/entries

packages/debugger/src/entries/main.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ import { startDeliveryApiPolling } from '../domain/deliveryApi'
1313
import { getProbes } from '../domain/probes'
1414
import { startDebuggerBatch } from '../transport/startDebuggerBatch'
1515

16+
type DebuggerInstrumentationGlobal = typeof globalThis & {
17+
$dd_entry?: typeof onEntry
18+
$dd_return?: typeof onReturn
19+
$dd_throw?: typeof onThrow
20+
$dd_probes?: typeof getProbes
21+
}
22+
1623
/**
1724
* Configuration options for initializing the Live Debugger SDK
1825
*/
@@ -106,10 +113,11 @@ function makeDebuggerPublicApi(): DebuggerPublicApi {
106113

107114
// Expose internal hooks on globalThis for instrumented code
108115
if (typeof globalThis !== 'undefined') {
109-
;(globalThis as any).$dd_entry = onEntry
110-
;(globalThis as any).$dd_return = onReturn
111-
;(globalThis as any).$dd_throw = onThrow
112-
;(globalThis as any).$dd_probes = getProbes
116+
const debuggerGlobal = globalThis as DebuggerInstrumentationGlobal
117+
debuggerGlobal.$dd_entry = onEntry
118+
debuggerGlobal.$dd_return = onReturn
119+
debuggerGlobal.$dd_throw = onThrow
120+
debuggerGlobal.$dd_probes = getProbes
113121
}
114122

115123
startDeliveryApiPolling({

0 commit comments

Comments
 (0)