@types/chrome 0.0.168 → 0.0.169

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +31 -16
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Chrome extension development (http://
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 06 Dec 2021 04:01:01 GMT
11
+ * Last updated: Thu, 09 Dec 2021 19:01:03 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
  * Global values: `chrome`
14
14
 
chrome/index.d.ts CHANGED
@@ -5402,6 +5402,8 @@ declare namespace chrome.networking.config {
5402
5402
  * @since Chrome 28.
5403
5403
  */
5404
5404
  declare namespace chrome.notifications {
5405
+ export type TemplateType = "basic" | "image" | "list" | "progress";
5406
+
5405
5407
  export interface ButtonOptions {
5406
5408
  title: string;
5407
5409
  iconUrl?: string | undefined;
@@ -5414,19 +5416,7 @@ declare namespace chrome.notifications {
5414
5416
  message: string;
5415
5417
  }
5416
5418
 
5417
- export interface NotificationOptions {
5418
- /** Optional. Which type of notification to display. Required for notifications.create method. */
5419
- type?: string | undefined;
5420
- /**
5421
- * Optional.
5422
- * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5423
- * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file Required for notifications.create method.
5424
- */
5425
- iconUrl?: string | undefined;
5426
- /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5427
- title?: string | undefined;
5428
- /** Optional. Main notification content. Required for notifications.create method. */
5429
- message?: string | undefined;
5419
+ export type NotificationOptions<T extends boolean = false> = {
5430
5420
  /**
5431
5421
  * Optional.
5432
5422
  * Alternate notification content with a lower-weight font.
@@ -5473,7 +5463,32 @@ declare namespace chrome.notifications {
5473
5463
  * @since Chrome 70
5474
5464
  */
5475
5465
  silent?: boolean | undefined;
5476
- }
5466
+ } & (T extends true ? {
5467
+ /**
5468
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5469
+ * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
5470
+ */
5471
+ iconUrl: string;
5472
+ /** Main notification content. Required for notifications.create method. */
5473
+ message: string;
5474
+ /** Which type of notification to display. Required for notifications.create method. */
5475
+ type: TemplateType;
5476
+ /** Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5477
+ title: string;
5478
+ } : {
5479
+ /**
5480
+ * Optional.
5481
+ * A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
5482
+ * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file. Required for notifications.create method.
5483
+ */
5484
+ iconUrl?: string | undefined;
5485
+ /** Optional. Main notification content. Required for notifications.create method. */
5486
+ message?: string | undefined;
5487
+ /** Optional. Which type of notification to display. Required for notifications.create method. */
5488
+ type?: TemplateType | undefined;
5489
+ /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */
5490
+ title?: string | undefined;
5491
+ })
5477
5492
 
5478
5493
  export interface NotificationClosedEvent
5479
5494
  extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> { }
@@ -5516,7 +5531,7 @@ declare namespace chrome.notifications {
5516
5531
  */
5517
5532
  export function create(
5518
5533
  notificationId: string,
5519
- options: NotificationOptions,
5534
+ options: NotificationOptions<true>,
5520
5535
  callback?: (notificationId: string) => void,
5521
5536
  ): void;
5522
5537
  /**
@@ -5529,7 +5544,7 @@ declare namespace chrome.notifications {
5529
5544
  * If you specify the callback parameter, it should be a function that looks like this:
5530
5545
  * function(string notificationId) {...};
5531
5546
  */
5532
- export function create(options: NotificationOptions, callback?: (notificationId: string) => void): void;
5547
+ export function create(options: NotificationOptions<true>, callback?: (notificationId: string) => void): void;
5533
5548
  /**
5534
5549
  * Updates an existing notification.
5535
5550
  * @param notificationId The id of the notification to be updated. This is returned by notifications.create method.
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.168",
3
+ "version": "0.0.169",
4
4
  "description": "TypeScript definitions for Chrome extension development",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -103,6 +103,6 @@
103
103
  "@types/filesystem": "*",
104
104
  "@types/har-format": "*"
105
105
  },
106
- "typesPublisherContentHash": "fe256390c65c3ad9525bd7c17c2a1c984d604df3aef194fbd962b6126ade8cad",
106
+ "typesPublisherContentHash": "602536495e691a80cf6e4d822b17751d3f2615eebca8617ae606281fe7279afc",
107
107
  "typeScriptVersion": "3.8"
108
108
  }