Skip to content

Commit 429b0da

Browse files
committed
Update api.ts
1 parent 8cefbfc commit 429b0da

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

packages-exp/messaging-exp/src/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
import { FirebaseApp, _getProvider, getApp } from '@firebase/app-exp';
1919
import {
20-
Messaging,
2120
GetTokenOptions,
22-
MessagePayload
21+
MessagePayload,
22+
Messaging
2323
} from './interfaces/public-types';
2424
import {
2525
NextFn,
@@ -151,7 +151,7 @@ export function onBackgroundMessage(
151151
* @public
152152
*/
153153
export function setDeliveryMetricsExportedToBigQueryEnabled(
154-
messaging: FirebaseMessaging,
154+
messaging: Messaging,
155155
enable: boolean
156156
): void {
157157
messaging = getModularInstance(messaging);

packages-exp/messaging-exp/src/api/setDeliveryMetricsExportedToBigQueryEnabled.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ export function _setDeliveryMetricsExportedToBigQueryEnabled(
2222
messaging: FirebaseMessaging,
2323
enable: boolean
2424
): void {
25-
(messaging as MessagingService).deliveryMetricsExportedToBigQueryEnabled = enable;
25+
(messaging as MessagingService).deliveryMetricsExportedToBigQueryEnabled =
26+
enable;
2627
}

packages-exp/messaging-exp/src/listeners/sw-listeners.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,5 +472,5 @@ function makeEvent<K extends keyof ServiceWorkerGlobalScopeEventMap>(
472472
): Writable<ServiceWorkerGlobalScopeEventMap[K]> {
473473
const event = new FakeEvent(type);
474474
Object.assign(event, data);
475-
return (event as unknown) as ServiceWorkerGlobalScopeEventMap[K];
475+
return event as unknown as ServiceWorkerGlobalScopeEventMap[K];
476476
}

packages-exp/messaging-exp/src/listeners/sw-listeners.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ function wrapInternalPayload(
161161
internalPayload: MessagePayloadInternal
162162
): NotificationPayloadInternal {
163163
const wrappedInternalPayload: NotificationPayloadInternal = {
164-
...((internalPayload.notification as unknown) as NotificationPayloadInternal)
164+
...(internalPayload.notification as unknown as NotificationPayloadInternal)
165165
};
166166

167167
// Put the message payload under FCM_MSG name so we can identify the notification as being an FCM

packages-exp/messaging-exp/src/messaging-service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ export class MessagingService implements _FirebaseService {
3939
| Observer<MessagePayload>
4040
| null = null;
4141

42-
onMessageHandler:
43-
| NextFn<MessagePayload>
44-
| Observer<MessagePayload>
45-
| null = null;
42+
onMessageHandler: NextFn<MessagePayload> | Observer<MessagePayload> | null =
43+
null;
4644

4745
logEvents: LogEvent[] = [];
4846
isLogServiceStarted: boolean = false;

packages/messaging/src/controllers/sw-controller.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ describe('SwController', () => {
354354
it('throws on invalid input', () => {
355355
expect(() =>
356356
swController.setBackgroundMessageHandler(
357-
(null as unknown) as BgMessageHandler
357+
null as unknown as BgMessageHandler
358358
)
359359
).to.throw('messaging/invalid-bg-handler');
360360
});
@@ -363,7 +363,7 @@ describe('SwController', () => {
363363
describe('usePublicVapidKey', () => {
364364
it('throws on invalid input', () => {
365365
expect(() =>
366-
swController.usePublicVapidKey((null as unknown) as string)
366+
swController.usePublicVapidKey(null as unknown as string)
367367
).to.throw('messaging/invalid-vapid-key');
368368

369369
expect(() => swController.usePublicVapidKey('')).to.throw(
@@ -604,5 +604,5 @@ function makeEvent<K extends keyof ServiceWorkerGlobalScopeEventMap>(
604604
): Writable<ServiceWorkerGlobalScopeEventMap[K]> {
605605
const event = new FakeEvent(type);
606606
Object.assign(event, data);
607-
return (event as unknown) as ServiceWorkerGlobalScopeEventMap[K];
607+
return event as unknown as ServiceWorkerGlobalScopeEventMap[K];
608608
}

packages/messaging/src/controllers/window-controller.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ describe('WindowController', () => {
447447
describe('usePublicVapidKey', () => {
448448
it('throws on invalid input', () => {
449449
expect(() =>
450-
windowController.usePublicVapidKey((null as unknown) as string)
450+
windowController.usePublicVapidKey(null as unknown as string)
451451
).to.throw('messaging/invalid-vapid-key');
452452

453453
expect(() => windowController.usePublicVapidKey('')).to.throw(
@@ -475,7 +475,7 @@ describe('WindowController', () => {
475475
it('throws on invalid input', () => {
476476
expect(() =>
477477
windowController.useServiceWorker(
478-
({} as unknown) as ServiceWorkerRegistration
478+
{} as unknown as ServiceWorkerRegistration
479479
)
480480
).to.throw('messaging/invalid-sw-registration');
481481
});

packages/messaging/src/testing/fakes/service-worker.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ class FakeWindowClient implements WindowClient {
9393
}
9494

9595
export class FakeServiceWorkerRegistration
96-
implements ServiceWorkerRegistration {
96+
implements ServiceWorkerRegistration
97+
{
9798
active = null;
9899
installing = null;
99100
waiting = null;
@@ -102,9 +103,9 @@ export class FakeServiceWorkerRegistration
102103
scope = '/scope-value';
103104

104105
// Unused in FCM Web SDK, no need to mock these.
105-
navigationPreload = (null as unknown) as NavigationPreloadManager;
106-
sync = (null as unknown) as SyncManager;
107-
updateViaCache = (null as unknown) as ServiceWorkerUpdateViaCache;
106+
navigationPreload = null as unknown as NavigationPreloadManager;
107+
sync = null as unknown as SyncManager;
108+
updateViaCache = null as unknown as ServiceWorkerUpdateViaCache;
108109

109110
async getNotifications() {
110111
return [];
@@ -160,8 +161,8 @@ export class FakePushSubscription implements PushSubscription {
160161
}
161162

162163
// Unused in FCM
163-
toJSON = (null as unknown) as () => PushSubscriptionJSON;
164-
options = (null as unknown) as PushSubscriptionOptions;
164+
toJSON = null as unknown as () => PushSubscriptionJSON;
165+
options = null as unknown as PushSubscriptionOptions;
165166
}
166167

167168
/**

0 commit comments

Comments
 (0)