Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update Webpush types in Messaging
  • Loading branch information
mmermerkaya committed Jun 1, 2018
commit 6a3db24886a0e481af05b4aea460b7debc4d5aaf
11 changes: 5 additions & 6 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,18 +438,17 @@ declare namespace admin.messaging {
title?: string;
body?: string;
};

type WebpushConfig = {
headers?: {[key: string]: string};
data?: {[key: string]: string};
notification?: WebpushNotification;
};
type WebpushNotification = {

interface WebpushNotification extends NotificationOptions {
title?: string;
body?: string;
icon?: string;
};
[key: string]: any;
}

type DataMessagePayload = {
[key: string]: string;
Expand Down
5 changes: 2 additions & 3 deletions src/messaging/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ export interface WebpushConfig {
notification?: WebpushNotification;
}

export interface WebpushNotification {
export interface WebpushNotification extends NotificationOptions {
title?: string;
body?: string;
icon?: string;
[key: string]: any;
}

export interface ApnsConfig {
Expand Down
16 changes: 16 additions & 0 deletions test/unit/messaging/messaging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,22 @@ describe('Messaging', () => {
title: 'test.title',
body: 'test.body',
icon: 'test.icon',
actions: [{
action: 'test.action.1',
title: 'test.action.1.title',
icon: 'test.action.1.icon',
}, {
action: 'test.action.2',
title: 'test.action.2.title',
icon: 'test.action.2.icon',
}],
badge: 'test.badge',
data: {
key: 'value',
},
dir: 'auto',
image: 'test.image',
requireInteraction: true,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"lib": ["es5", "es2015.promise", "es2015"],
"lib": ["es5", "es2015.promise", "es2015", "dom"],
"outDir": "lib",
// We manually craft typings in src/index.d.ts instead of auto-generating them.
// "declaration": true,
Expand Down