@types/chrome 0.2.7 → 0.2.9

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 +2 -2
  2. chrome/index.d.ts +105 -28
  3. chrome/package.json +2 -42
chrome/README.md CHANGED
@@ -8,8 +8,8 @@ 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: Fri, 21 Aug 2026 19:38:26 GMT
11
+ * Last updated: Sat, 05 Sep 2026 20:03:40 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
15
- These definitions were written by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10), [sreimer15](https://github.com/sreimer15), [MatCarlson](https://github.com/MatCarlson), [ekinsol](https://github.com/ekinsol), [Brian Wilson](https://github.com/echoabstract), [Sebastiaan Pasma](https://github.com/spasma), [bdbai](https://github.com/bdbai), [Jason Xian](https://github.com/JasonXian), [userTim](https://github.com/usertim), [Idan Zeierman](https://github.com/idan315), [Nicolas Rodriguez](https://github.com/nicolas377), [Ido Salomon](https://github.com/idosal), [Federico Brigante](https://github.com/fregante), and [Erwan Jugand](https://github.com/erwanjugand).
15
+ These definitions were written by [MatCarlson](https://github.com/MatCarlson), [Jason Xian](https://github.com/JasonXian), [userTim](https://github.com/usertim), [Nicolas Rodriguez](https://github.com/nicolas377), [Ido Salomon](https://github.com/idosal), [Federico Brigante](https://github.com/fregante), and [Erwan Jugand](https://github.com/erwanjugand).
chrome/index.d.ts CHANGED
@@ -394,6 +394,11 @@ declare namespace chrome {
394
394
  export namespace alarms {
395
395
  type AlarmCreateInfo =
396
396
  & {
397
+ /**
398
+ * Name of this alarm.
399
+ * @since Chrome 152
400
+ */
401
+ name?: string | undefined;
397
402
  /**
398
403
  * Whether the alarm should persist across sessions (browser restarts). In Chrome, this defaults to true to match historical behavior, but you should set this explicitly to maximize compatibility across browsers.
399
404
  * @since Chrome 150
@@ -453,9 +458,18 @@ declare namespace chrome {
453
458
  * Can return its result via Promise in Manifest V3 or later since Chrome 111.
454
459
  */
455
460
  function create(alarmInfo: AlarmCreateInfo): Promise<void>;
456
- function create(name: string | undefined, alarmInfo: AlarmCreateInfo): Promise<void>;
461
+ function create(name: undefined, alarmInfo: AlarmCreateInfo): Promise<void>;
462
+ function create<T extends AlarmCreateInfo>(
463
+ name: string,
464
+ alarmInfo: T & (T extends { name: string } ? never : unknown),
465
+ ): Promise<void>;
457
466
  function create(alarmInfo: AlarmCreateInfo, callback: () => void): void;
458
- function create(name: string | undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void;
467
+ function create(name: undefined, alarmInfo: AlarmCreateInfo, callback: () => void): void;
468
+ function create<T extends AlarmCreateInfo>(
469
+ name: string,
470
+ alarmInfo: T & (T extends { name: string } ? never : unknown),
471
+ callback: () => void,
472
+ ): void;
459
473
 
460
474
  /**
461
475
  * Gets an array of all the alarms.
@@ -2888,20 +2902,59 @@ declare namespace chrome {
2888
2902
  injectedScript?: string | undefined;
2889
2903
  }
2890
2904
 
2891
- interface EvaluationExceptionInfo {
2892
- /** Set if the error occurred on the DevTools side before the expression is evaluated. */
2893
- isError: boolean;
2894
- /** Set if the error occurred on the DevTools side before the expression is evaluated. */
2895
- code: string;
2896
- /** Set if the error occurred on the DevTools side before the expression is evaluated. */
2897
- description: string;
2898
- /** Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error. */
2899
- details: any[];
2900
- /** Set if the evaluated code produces an unhandled exception. */
2901
- isException: boolean;
2902
- /** Set if the evaluated code produces an unhandled exception. */
2903
- value: string;
2904
- }
2905
+ type EvaluationExceptionInfo =
2906
+ | {
2907
+ /**
2908
+ * Set if the error occurred on the DevTools side before the expression is evaluated.
2909
+ *
2910
+ * If `isError` is set to true, a DevTools-side error has occurred, and `code` is set to an error code.
2911
+ *
2912
+ * See the docs on `isException` for more details on parsing this object.
2913
+ */
2914
+ isError: true;
2915
+ /** Set if the error occurred on the DevTools side before the expression is evaluated. */
2916
+ code: string;
2917
+ /** Set if the error occurred on the DevTools side before the expression is evaluated. */
2918
+ description: string;
2919
+ /** Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error. */
2920
+ details: any[];
2921
+ /**
2922
+ * Set if the evaluated code produces an unhandled exception.
2923
+ *
2924
+ * If `isException` is non-null but not true, and `isError` is true, a DevTools-side error has occurred, and `code` is set to an error code.
2925
+ *
2926
+ * If `isException` is set to true, a JavaScript error has occurred, and `value` is set to the string value of the thrown object.
2927
+ */
2928
+ isException?: undefined;
2929
+ /** Set if the evaluated code produces an unhandled exception. */
2930
+ value?: undefined;
2931
+ }
2932
+ | {
2933
+ /**
2934
+ * Set if the error occurred on the DevTools side before the expression is evaluated.
2935
+ *
2936
+ * If `isError` is set to true, a DevTools-side error has occurred, and `code` is set to an error code.
2937
+ *
2938
+ * See the docs on `isException` for more details on parsing this object.
2939
+ */
2940
+ isError?: undefined;
2941
+ /** Set if the error occurred on the DevTools side before the expression is evaluated. */
2942
+ code?: undefined;
2943
+ /** Set if the error occurred on the DevTools side before the expression is evaluated. */
2944
+ description?: undefined;
2945
+ /** Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error. */
2946
+ details?: undefined;
2947
+ /**
2948
+ * Set if the evaluated code produces an unhandled exception.
2949
+ *
2950
+ * If `isException` is non-null but not true, and `isError` is true, a DevTools-side error has occurred, and `code` is set to an error code.
2951
+ *
2952
+ * If `isException` is set to true, a JavaScript error has occurred, and `value` is set to the string value of the thrown object.
2953
+ */
2954
+ isException: true;
2955
+ /** Set if the evaluated code produces an unhandled exception. */
2956
+ value: string;
2957
+ };
2905
2958
 
2906
2959
  /** The ID of the tab being inspected. This ID may be used with {@link chrome.tabs} API. */
2907
2960
  const tabId: number;
@@ -2921,15 +2974,23 @@ declare namespace chrome {
2921
2974
  function eval<T = { [key: string]: unknown }>(
2922
2975
  expression: string,
2923
2976
  options?: EvalOptions,
2924
- ): Promise<{ result: T; exceptionInfo: EvaluationExceptionInfo }>;
2977
+ ): Promise<T>;
2925
2978
  function eval<T = { [key: string]: unknown }>(
2926
2979
  expression: string,
2927
- callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
2980
+ callback: (
2981
+ ...args:
2982
+ | [result: T, exceptionInfo: undefined]
2983
+ | [result: undefined, exceptionInfo: EvaluationExceptionInfo]
2984
+ ) => void,
2928
2985
  ): void;
2929
2986
  function eval<T = { [key: string]: unknown }>(
2930
2987
  expression: string,
2931
2988
  options: EvalOptions | undefined,
2932
- callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void,
2989
+ callback: (
2990
+ ...args:
2991
+ | [result: T, exceptionInfo: undefined]
2992
+ | [result: undefined, exceptionInfo: EvaluationExceptionInfo]
2993
+ ) => void,
2933
2994
  ): void;
2934
2995
 
2935
2996
  /**
@@ -3074,10 +3135,13 @@ declare namespace chrome {
3074
3135
  /**
3075
3136
  * Creates a pane within panel's sidebar.
3076
3137
  * @param title Text that is displayed in sidebar caption.
3138
+ *
3139
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3077
3140
  */
3141
+ createSidebarPane(title: string): Promise<ExtensionSidebarPane>;
3078
3142
  createSidebarPane(
3079
3143
  title: string,
3080
- callback?: (
3144
+ callback: (
3081
3145
  /** An ExtensionSidebarPane object for created sidebar pane. */
3082
3146
  result: ExtensionSidebarPane,
3083
3147
  ) => void,
@@ -3091,10 +3155,13 @@ declare namespace chrome {
3091
3155
  /**
3092
3156
  * Creates a pane within panel's sidebar.
3093
3157
  * @param title Text that is displayed in sidebar caption.
3158
+ *
3159
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3094
3160
  */
3161
+ createSidebarPane(title: string): Promise<ExtensionSidebarPane>;
3095
3162
  createSidebarPane(
3096
3163
  title: string,
3097
- callback?: (
3164
+ callback: (
3098
3165
  /** An ExtensionSidebarPane object for created sidebar pane. */
3099
3166
  result: ExtensionSidebarPane,
3100
3167
  ) => void,
@@ -3114,19 +3181,23 @@ declare namespace chrome {
3114
3181
  * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.
3115
3182
  * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch.
3116
3183
  * @param rootTitle An optional title for the root of the expression tree.
3184
+ *
3185
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3117
3186
  */
3118
- setExpression(expression: string, callback?: () => void): void;
3119
- setExpression(expression: string, rootTitle: string | undefined, callback?: () => void): void;
3187
+ setExpression(expression: string, rootTitle?: string): Promise<void>;
3188
+ setExpression(expression: string, rootTitle: string | undefined, callback: () => void): void;
3120
3189
  /**
3121
3190
  * Sets a JSON-compliant object to be displayed in the sidebar pane.
3122
3191
  * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client).
3123
3192
  * @param rootTitle An optional title for the root of the expression tree.
3193
+ *
3194
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3124
3195
  */
3125
- setObject(jsonObject: { [key: string]: unknown }, callback?: () => void): void;
3196
+ setObject(jsonObject: { [key: string]: unknown }, rootTitle?: string): Promise<void>;
3126
3197
  setObject(
3127
3198
  jsonObject: { [key: string]: unknown },
3128
3199
  rootTitle: string | undefined,
3129
- callback?: () => void,
3200
+ callback: () => void,
3130
3201
  ): void;
3131
3202
  /**
3132
3203
  * Sets an HTML page to be displayed in the sidebar pane.
@@ -3156,12 +3227,15 @@ declare namespace chrome {
3156
3227
  * @param title Title that is displayed next to the extension icon in the Developer Tools toolbar.
3157
3228
  * @param iconPath Path of the panel's icon relative to the extension directory.
3158
3229
  * @param pagePath Path of the panel's HTML page relative to the extension directory.
3230
+ *
3231
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3159
3232
  */
3233
+ function create(title: string, iconPath: string, pagePath: string): Promise<ExtensionPanel>;
3160
3234
  function create(
3161
3235
  title: string,
3162
3236
  iconPath: string,
3163
3237
  pagePath: string,
3164
- callback?: (
3238
+ callback: (
3165
3239
  /** An ExtensionPanel object representing the created panel. */
3166
3240
  panel: ExtensionPanel,
3167
3241
  ) => void,
@@ -3188,13 +3262,16 @@ declare namespace chrome {
3188
3262
  * @param url The URL of the resource to open.
3189
3263
  * @param lineNumber Specifies the line number to scroll to when the resource is loaded.
3190
3264
  * @param columnNumber Specifies the column number to scroll to when the resource is loaded.
3265
+ *
3266
+ * Can return its result via Promise in Manifest V3 or later since Chrome 152.
3191
3267
  */
3192
- function openResource(url: string, lineNumber: number, callback?: () => void): void;
3268
+ function openResource(url: string, lineNumber: number, columnNumber?: number): Promise<void>;
3269
+ function openResource(url: string, lineNumber: number, callback: () => void): void;
3193
3270
  function openResource(
3194
3271
  url: string,
3195
3272
  lineNumber: number,
3196
3273
  columnNumber: number | undefined,
3197
- callback?: () => void,
3274
+ callback: () => void,
3198
3275
  ): void;
3199
3276
 
3200
3277
  /**
chrome/package.json CHANGED
@@ -1,50 +1,15 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
7
7
  "contributors": [
8
- {
9
- "name": "Matthew Kimber",
10
- "githubUsername": "matthewkimber",
11
- "url": "https://github.com/matthewkimber"
12
- },
13
- {
14
- "name": "otiai10",
15
- "githubUsername": "otiai10",
16
- "url": "https://github.com/otiai10"
17
- },
18
- {
19
- "name": "sreimer15",
20
- "githubUsername": "sreimer15",
21
- "url": "https://github.com/sreimer15"
22
- },
23
8
  {
24
9
  "name": "MatCarlson",
25
10
  "githubUsername": "MatCarlson",
26
11
  "url": "https://github.com/MatCarlson"
27
12
  },
28
- {
29
- "name": "ekinsol",
30
- "githubUsername": "ekinsol",
31
- "url": "https://github.com/ekinsol"
32
- },
33
- {
34
- "name": "Brian Wilson",
35
- "githubUsername": "echoabstract",
36
- "url": "https://github.com/echoabstract"
37
- },
38
- {
39
- "name": "Sebastiaan Pasma",
40
- "githubUsername": "spasma",
41
- "url": "https://github.com/spasma"
42
- },
43
- {
44
- "name": "bdbai",
45
- "githubUsername": "bdbai",
46
- "url": "https://github.com/bdbai"
47
- },
48
13
  {
49
14
  "name": "Jason Xian",
50
15
  "githubUsername": "JasonXian",
@@ -55,11 +20,6 @@
55
20
  "githubUsername": "usertim",
56
21
  "url": "https://github.com/usertim"
57
22
  },
58
- {
59
- "name": "Idan Zeierman",
60
- "githubUsername": "idan315",
61
- "url": "https://github.com/idan315"
62
- },
63
23
  {
64
24
  "name": "Nicolas Rodriguez",
65
25
  "githubUsername": "nicolas377",
@@ -94,6 +54,6 @@
94
54
  "@types/har-format": "*"
95
55
  },
96
56
  "peerDependencies": {},
97
- "typesPublisherContentHash": "47a32e4859f36cb5c33ad530ec591ce35a563d6725344169f0b57debde67a4d3",
57
+ "typesPublisherContentHash": "f5961bea7501409c00f4d057d324fcadcefdc9adee1b3d33f0dad9cca1597b91",
98
58
  "typeScriptVersion": "5.6"
99
59
  }