Skip to content

Commit 836094c

Browse files
fix(service-worker): resolve TS 6.0 compatibility for messageerror listener
In standard DOM definitions (lib.webworker.d.ts), the messageerror event is typed as MessageEvent, which lacks the waitUntil property found on ExtendableMessageEvent. In modern versions of TypeScript (including TS 6.0), this causes compile-time overload resolution errors when the listener function is explicitly typed to expect ExtendableMessageEvent.
1 parent 68628dd commit 836094c

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ bazel_dep(name = "yq.bzl", version = "0.3.5")
1818
bazel_dep(name = "rules_angular")
1919
git_override(
2020
module_name = "rules_angular",
21-
commit = "346e8fe8e51c743f44771def707ea3a2f10abbdd",
21+
commit = "4dd1f9fc6844b40c0eda797b9b13c66746ce9564",
2222
remote = "https://github.com/angular/rules_angular.git",
2323
)
2424

MODULE.bazel.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/service-worker/worker/src/driver.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ export class Driver implements Debuggable, UpdateSource {
212212
this.scope.addEventListener('notificationclick', (event) => this.onClick(event));
213213
this.scope.addEventListener('notificationclose', (event) => this.onClose(event));
214214
this.scope.addEventListener('pushsubscriptionchange', (event) =>
215-
// This is a bug in TypeScript, where they removed `PushSubscriptionChangeEvent`
216-
// based on the incorrect assumption that browsers don't support it.
217-
this.onPushSubscriptionChange(event as PushSubscriptionChangeEvent),
215+
this.onPushSubscriptionChange(event),
218216
);
219217
this.scope.addEventListener('messageerror', (event) => this.onMessageError(event));
220218
this.scope.addEventListener('unhandledrejection', (event) => this.onUnhandledRejection(event));
@@ -355,7 +353,7 @@ export class Driver implements Debuggable, UpdateSource {
355353
event.waitUntil(this.handlePushSubscriptionChange(event));
356354
}
357355

358-
private onMessageError(event: MessageEvent<unknown>): void {
356+
private onMessageError(event: ExtendableMessageEvent): void {
359357
// Handle message deserialization errors that occur when receiving messages
360358
// that cannot be deserialized, typically due to corrupted data or unsupported formats.
361359
this.debugger.log(

0 commit comments

Comments
 (0)