Skip to content

Commit 49cbdca

Browse files
committed
fix(browser): Use correct global object type in registerWebWorker
1 parent 5ee2597 commit 49cbdca

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/browser/src/integrations/webWorker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface WebWorkerIntegration extends Integration {
2525
* any messages from the worker. Otherwise, your message handlers will receive
2626
* messages from the Sentry SDK which you need to ignore.
2727
*
28-
* This integration only has an effect, if you call `Sentry.registerWorker(self)`
28+
* This integration only has an effect, if you call `Sentry.registerWebWorker(self)`
2929
* from within the worker(s) you're adding to the integration.
3030
*
3131
* Given that you want to initialize the SDK as early as possible, you most likely
@@ -114,7 +114,7 @@ function listenForSentryDebugIdMessages(worker: Worker): void {
114114
}
115115

116116
interface RegisterWebWorkerOptions {
117-
self: Worker & { _sentryDebugIds?: Record<string, string> };
117+
self: DedicatedWorkerGlobalScope & { _sentryDebugIds?: Record<string, string> };
118118
}
119119

120120
/**
@@ -125,7 +125,7 @@ interface RegisterWebWorkerOptions {
125125
* import * as Sentry from '@sentry/<your-sdk>';
126126
*
127127
* // Do this as early as possible in your worker.
128-
* Sentry.registerWorker({ self });
128+
* Sentry.registerWebWorker({ self });
129129
*
130130
* // continue setting up your worker
131131
* self.postMessage(...)

packages/browser/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"include": ["src/**/*", "test/loader.js"],
55

66
"compilerOptions": {
7-
"lib": ["DOM", "ES2018"],
7+
"lib": ["DOM", "ES2018", "WebWorker"]
88
}
99
}

0 commit comments

Comments
 (0)