@types/chrome 0.1.28 → 0.1.29

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 +87 -139
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (https://developer.chrome.com/
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 11 Nov 2025 22:02:08 GMT
11
+ * Last updated: Fri, 14 Nov 2025 20:02: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
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -10025,209 +10025,157 @@ declare namespace chrome {
10025
10025
  export interface StorageArea {
10026
10026
  /**
10027
10027
  * Gets the amount of space (in bytes) being used by one or more items.
10028
- * @param keys Optional. A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
10029
- * @return A Promise that resolves with a number
10030
- * @since MV3
10028
+ * @param keys A single key or list of keys to get the total usage for. An empty list will return 0. Pass in `null` to get the total usage of all of storage.
10029
+ *
10030
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
10031
10031
  */
10032
+ getBytesInUse(keys: never[]): Promise<0>;
10032
10033
  getBytesInUse<T = { [key: string]: any }>(keys?: keyof T | Array<keyof T> | null): Promise<number>;
10033
- /**
10034
- * Gets the amount of space (in bytes) being used by one or more items.
10035
- * @param keys Optional. A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
10036
- * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set).
10037
- * Parameter bytesInUse: Amount of space being used in storage, in bytes.
10038
- */
10034
+ getBytesInUse<T = { [key: string]: any }>(callback: (bytesInUse: number) => void): void;
10035
+ getBytesInUse(keys: never[], callback: (bytesInUse: 0) => void): void;
10039
10036
  getBytesInUse<T = { [key: string]: any }>(
10040
- keys: keyof T | Array<keyof T> | null,
10037
+ keys: keyof T | Array<keyof T> | null | undefined,
10041
10038
  callback: (bytesInUse: number) => void,
10042
10039
  ): void;
10043
- /**
10044
- * Gets the amount of space (in bytes) being used by one or more items.
10045
- * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set).
10046
- * Parameter bytesInUse: Amount of space being used in storage, in bytes.
10047
- */
10048
- getBytesInUse(callback: (bytesInUse: number) => void): void;
10040
+
10049
10041
  /**
10050
10042
  * Removes all items from storage.
10051
- * @return A void Promise
10052
- * @since MV3
10043
+ *
10044
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
10053
10045
  */
10054
10046
  clear(): Promise<void>;
10055
- /**
10056
- * Removes all items from storage.
10057
- * @param callback Optional.
10058
- * Callback on success, or on failure (in which case runtime.lastError will be set).
10059
- */
10060
10047
  clear(callback: () => void): void;
10048
+
10061
10049
  /**
10062
10050
  * Sets multiple items.
10063
- * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.
10064
- * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation).
10065
- * @return A void Promise
10066
- * @since MV3
10051
+ * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. Primitive values such as numbers will serialize as expected. Values with a `typeof` `object` and `function` will typically serialize to `{}`, with the exception of `Array` (serializes as expected), `Date`, and `Regex` (serialize using their `String` representation).
10052
+ *
10053
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
10067
10054
  */
10068
10055
  set<T = { [key: string]: any }>(items: Partial<T>): Promise<void>;
10069
- /**
10070
- * Sets multiple items.
10071
- * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.
10072
- * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation).
10073
- * @param callback Optional.
10074
- * Callback on success, or on failure (in which case runtime.lastError will be set).
10075
- */
10076
10056
  set<T = { [key: string]: any }>(items: Partial<T>, callback: () => void): void;
10057
+
10077
10058
  /**
10078
10059
  * Removes one or more items from storage.
10079
10060
  * @param keys A single key or a list of keys for items to remove.
10080
- * @param callback Optional.
10081
- * @return A void Promise
10082
- * @since MV3
10061
+ *
10062
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
10083
10063
  */
10084
10064
  remove<T = { [key: string]: any }>(keys: keyof T | Array<keyof T>): Promise<void>;
10085
- /**
10086
- * Removes one or more items from storage.
10087
- * @param keys A single key or a list of keys for items to remove.
10088
- * @param callback Optional.
10089
- * Callback on success, or on failure (in which case runtime.lastError will be set).
10090
- */
10091
10065
  remove<T = { [key: string]: any }>(keys: keyof T | Array<keyof T>, callback: () => void): void;
10066
+
10092
10067
  /**
10093
10068
  * Gets one or more items from storage.
10094
- * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
10095
- * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
10096
- * @return A Promise that resolves with an object containing items
10097
- * @since MV3
10069
+ * @param keys A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in `null` to get the entire contents of storage.
10070
+ *
10071
+ * Can return its result via Promise in Manifest V3 or later since Chrome 95.
10098
10072
  */
10099
- get<T = { [key: string]: any }>(
10073
+ get(keys: never[] | Record<string, never>): Promise<{ [key: string]: never }>;
10074
+ get<T = { [key: string]: unknown }>(
10100
10075
  keys?: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
10101
10076
  ): Promise<T>;
10102
- /**
10103
- * Gets one or more items from storage.
10104
- * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
10105
- * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
10106
- * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
10107
- * Parameter items: Object with items in their key-value mappings.
10108
- */
10109
- get<T = { [key: string]: any }>(
10110
- keys: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
10077
+ get<T = { [key: string]: unknown }>(callback: (items: T) => void): void;
10078
+ get(keys: never[] | Record<string, never>, callback: (items: { [key: string]: never }) => void): void;
10079
+ get<T = { [key: string]: unknown }>(
10080
+ keys: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null | undefined,
10111
10081
  callback: (items: T) => void,
10112
10082
  ): void;
10083
+
10113
10084
  /**
10114
- * Gets the entire contents of storage.
10115
- * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
10116
- * Parameter items: Object with items in their key-value mappings.
10117
- */
10118
- get<T = { [key: string]: any }>(callback: (items: T) => void): void;
10119
- /**
10120
- * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
10121
- * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
10122
- * @return A void Promise.
10123
- * @since Chrome 102
10124
- */
10125
- setAccessLevel(accessOptions: { accessLevel: AccessLevel }): Promise<void>;
10126
- /**
10127
- * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while managed, local, and sync storage allow access from both trusted and untrusted contexts.
10128
- * @param accessOptions An object containing an accessLevel key which contains the access level of the storage area.
10129
- * @param callback Optional.
10085
+ * Sets the desired access level for the storage area. By default, session storage is restricted to trusted contexts (extension pages and service workers), while `managed`, `local`, and `sync` storage allow access from both trusted and untrusted contexts.
10086
+ * @param accessOptions The access level of the storage area.
10087
+ *
10088
+ * Can return its result via Promise in Manifest V3 or later.
10130
10089
  * @since Chrome 102
10131
10090
  */
10132
- setAccessLevel(accessOptions: { accessLevel: AccessLevel }, callback: () => void): void;
10133
- /**
10134
- * Fired when one or more items change within this storage area.
10135
- * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
10136
- * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.
10137
- * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
10138
- * Parameter items: Object with items in their key-value mappings.
10139
- */
10140
- onChanged: StorageAreaChangedEvent;
10091
+ setAccessLevel(accessOptions: { accessLevel: `${AccessLevel}` }): Promise<void>;
10092
+ setAccessLevel(accessOptions: { accessLevel: `${AccessLevel}` }, callback: () => void): void;
10093
+
10094
+ /** Fired when one or more items change. */
10095
+ onChanged: events.Event<(changes: { [key: string]: StorageChange }) => void>;
10096
+
10141
10097
  /**
10142
10098
  * Gets all keys from storage.
10143
- * @return A Promise that resolves with an array of keys.
10099
+ *
10100
+ * Can return its result via Promise in Manifest V3 or later.
10144
10101
  * @since Chrome 130
10145
10102
  */
10146
10103
  getKeys(): Promise<string[]>;
10147
- /**
10148
- * Gets all keys from storage.
10149
- * @param callback Callback with storage keys.
10150
- * Parameter keys: Array of keys in storage.
10151
- * @since Chrome 130
10152
- */
10153
10104
  getKeys(callback: (keys: string[]) => void): void;
10154
10105
  }
10155
10106
 
10156
10107
  export interface StorageChange {
10157
- /** Optional. The new value of the item, if there is a new value. */
10158
- newValue?: any;
10159
- /** Optional. The old value of the item, if there was an old value. */
10160
- oldValue?: any;
10108
+ /** The new value of the item, if there is a new value. */
10109
+ newValue?: unknown;
10110
+ /** The old value of the item, if there was an old value. */
10111
+ oldValue?: unknown;
10161
10112
  }
10162
10113
 
10163
10114
  export interface LocalStorageArea extends StorageArea {
10164
- /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */
10165
- QUOTA_BYTES: number;
10115
+ /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or a rejected Promise if using async/await. */
10116
+ QUOTA_BYTES: 10485760;
10166
10117
  }
10167
10118
 
10168
10119
  export interface SyncStorageArea extends StorageArea {
10169
- /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */
10170
- MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number;
10171
- /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */
10172
- QUOTA_BYTES: number;
10173
- /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */
10174
- QUOTA_BYTES_PER_ITEM: number;
10175
- /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */
10176
- MAX_ITEMS: number;
10177
- /**
10178
- * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit.
10179
- * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.
10120
+ /** @deprecated The storage.sync API no longer has a sustained write operation quota. */
10121
+ MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: 1000000;
10122
+ /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10123
+ QUOTA_BYTES: 102400;
10124
+ /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10125
+ QUOTA_BYTES_PER_ITEM: 8192;
10126
+ /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10127
+ MAX_ITEMS: 512;
10128
+ /**
10129
+ * The maximum number of `set`, `remove`, or `clear` operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit.
10130
+ *
10131
+ * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected.
10180
10132
  */
10181
- MAX_WRITE_OPERATIONS_PER_HOUR: number;
10133
+ MAX_WRITE_OPERATIONS_PER_HOUR: 1800;
10182
10134
  /**
10183
- * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time.
10184
- * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.
10185
- * @since Chrome 40
10135
+ * The maximum number of `set`, `remove`, or `clear` operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time.
10136
+ *
10137
+ * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected.
10186
10138
  */
10187
- MAX_WRITE_OPERATIONS_PER_MINUTE: number;
10139
+ MAX_WRITE_OPERATIONS_PER_MINUTE: 120;
10188
10140
  }
10189
10141
 
10190
10142
  export interface SessionStorageArea extends StorageArea {
10191
- /** The maximum amount (in bytes) of data that can be stored in memory, as measured by estimating the dynamically allocated memory usage of every value and key. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */
10192
- QUOTA_BYTES: number;
10143
+ /** The maximum amount (in bytes) of data that can be stored in memory, as measured by estimating the dynamically allocated memory usage of every value and key. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError when using a callback, or when a Promise is rejected. */
10144
+ QUOTA_BYTES: 10485760;
10193
10145
  }
10194
10146
 
10195
- export interface StorageAreaChangedEvent
10196
- extends chrome.events.Event<(changes: { [key: string]: StorageChange }) => void>
10197
- {}
10198
-
10199
- export type AreaName = keyof Pick<typeof chrome.storage, "sync" | "local" | "managed" | "session">;
10200
- export interface StorageChangedEvent
10201
- extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>
10202
- {}
10147
+ export type AreaName = "sync" | "local" | "managed" | "session";
10203
10148
 
10204
- export type AccessLevel = keyof typeof AccessLevel;
10149
+ /**
10150
+ * The storage area's access level.
10151
+ * @since Chrome 102
10152
+ */
10153
+ export enum AccessLevel {
10154
+ /** Specifies contexts originating from the extension itself. */
10155
+ TRUSTED_CONTEXTS = "TRUSTED_CONTEXTS",
10156
+ /** Specifies contexts originating from outside the extension. */
10157
+ TRUSTED_AND_UNTRUSTED_CONTEXTS = "TRUSTED_AND_UNTRUSTED_CONTEXTS",
10158
+ }
10205
10159
 
10206
- /** The storage area's access level. */
10207
- export var AccessLevel: {
10208
- TRUSTED_AND_UNTRUSTED_CONTEXTS: "TRUSTED_AND_UNTRUSTED_CONTEXTS";
10209
- TRUSTED_CONTEXTS: "TRUSTED_CONTEXTS";
10210
- };
10160
+ /** Items in the `local` storage area are local to each machine. */
10161
+ export const local: LocalStorageArea;
10211
10162
 
10212
- /** Items in the local storage area are local to each machine. */
10213
- export var local: LocalStorageArea;
10214
- /** Items in the sync storage area are synced using Chrome Sync. */
10215
- export var sync: SyncStorageArea;
10163
+ /** Items in the `sync` storage area are synced using Chrome Sync. */
10164
+ export const sync: SyncStorageArea;
10216
10165
 
10217
- /**
10218
- * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error.
10219
- * @since Chrome 33
10220
- */
10221
- export var managed: StorageArea;
10166
+ /** Items in the `managed` storage area are set by an enterprise policy configured by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. For information on configuring a policy, see Manifest for storage areas. */
10167
+ export const managed: StorageArea;
10222
10168
 
10223
10169
  /**
10224
- * Items in the session storage area are stored in-memory and will not be persisted to disk.
10170
+ * Items in the `session` storage area are stored in-memory and will not be persisted to disk.
10171
+ *
10172
+ * MV3 only
10225
10173
  * @since Chrome 102
10226
10174
  */
10227
- export var session: SessionStorageArea;
10175
+ export const session: SessionStorageArea;
10228
10176
 
10229
10177
  /** Fired when one or more items change. */
10230
- export var onChanged: StorageChangedEvent;
10178
+ export const onChanged: events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>;
10231
10179
  }
10232
10180
 
10233
10181
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -94,6 +94,6 @@
94
94
  "@types/har-format": "*"
95
95
  },
96
96
  "peerDependencies": {},
97
- "typesPublisherContentHash": "27f80367b3fa7447dd13ccd50fb050b324ddad2357beb3628dacba26011615a9",
97
+ "typesPublisherContentHash": "8768e75a0259479136460b35c7f59014494e96cd25273d8e592186b131d8e9fc",
98
98
  "typeScriptVersion": "5.2"
99
99
  }