Skip to content

Commit 6fc9b0b

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 e739e7e commit 6fc9b0b

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
*/
@@ -98,10 +105,11 @@ function makeDebuggerPublicApi(): DatadogDebugger {
98105

99106
// Expose internal hooks on globalThis for instrumented code
100107
if (typeof globalThis !== 'undefined') {
101-
;(globalThis as any).$dd_entry = onEntry
102-
;(globalThis as any).$dd_return = onReturn
103-
;(globalThis as any).$dd_throw = onThrow
104-
;(globalThis as any).$dd_probes = getProbes
108+
const debuggerGlobal = globalThis as DebuggerInstrumentationGlobal
109+
debuggerGlobal.$dd_entry = onEntry
110+
debuggerGlobal.$dd_return = onReturn
111+
debuggerGlobal.$dd_throw = onThrow
112+
debuggerGlobal.$dd_probes = getProbes
105113
}
106114

107115
startDeliveryApiPolling({

0 commit comments

Comments
 (0)