@types/chrome 0.0.190 → 0.0.193

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +13 -12
  3. chrome/package.json +3 -3
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: Tue, 07 Jun 2022 23:31:32 GMT
11
+ * Last updated: Tue, 05 Jul 2022 00:02:16 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
@@ -7570,11 +7570,11 @@ declare namespace chrome.scripting {
7570
7570
  /* The JavaScript world for a script to execute within. */
7571
7571
  export type ExecutionWorld = 'ISOLATED' | 'MAIN';
7572
7572
 
7573
- export interface InjectionResult {
7573
+ export interface InjectionResult<T> {
7574
7574
  /* The frame associated with the injection. */
7575
7575
  frameId: number;
7576
7576
  /* The result of the script execution. */
7577
- result?: any;
7577
+ result: T;
7578
7578
  }
7579
7579
 
7580
7580
  export interface InjectionTarget {
@@ -7597,7 +7597,7 @@ declare namespace chrome.scripting {
7597
7597
  target: InjectionTarget;
7598
7598
  }
7599
7599
 
7600
- export type ScriptInjection<Args extends any[] = []> = {
7600
+ export type ScriptInjection<Args extends any[], Result> = {
7601
7601
  /* Details specifying the target into which to inject the script. */
7602
7602
  target: InjectionTarget;
7603
7603
  /* The JavaScript world for a script to execute within. */
@@ -7607,14 +7607,15 @@ declare namespace chrome.scripting {
7607
7607
  files: string[];
7608
7608
  } | ({
7609
7609
  /* A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of files and function must be specified. */
7610
- func: ((...args: Args) => void);
7611
- } & (Args extends [] ? {
7612
- /* The arguments to carry into a provided function. This is only valid if the func parameter is specified. These arguments must be JSON-serializable. */
7613
- args?: Args;
7614
- } : {
7610
+ func: () => Result;
7611
+ } | {
7612
+ /* A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of files and function must be specified. */
7613
+ func: (...args: Args) => Result;
7615
7614
  /* The arguments to carry into a provided function. This is only valid if the func parameter is specified. These arguments must be JSON-serializable. */
7616
7615
  args: Args;
7617
- })))
7616
+ }))
7617
+
7618
+ type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
7618
7619
 
7619
7620
  /**
7620
7621
  * Injects a script into a target context. The script will be run at document_end.
@@ -7622,7 +7623,7 @@ declare namespace chrome.scripting {
7622
7623
  * The details of the script which to inject.
7623
7624
  * @return The `executeScript` method provides its result via callback or returned as a `Promise` (MV3 only). The resulting array contains the result of execution for each frame where the injection succeeded.
7624
7625
  */
7625
- export function executeScript<Args extends any[]>(injection: ScriptInjection<Args>): Promise<InjectionResult[]>;
7626
+ export function executeScript<Args extends any[], Result>(injection: ScriptInjection<Args, Result>): Promise<InjectionResult<Awaited<Result>>[]>;
7626
7627
 
7627
7628
  /**
7628
7629
  * Injects a script into a target context. The script will be run at document_end.
@@ -7631,7 +7632,7 @@ declare namespace chrome.scripting {
7631
7632
  * @param callback
7632
7633
  * Invoked upon completion of the injection. The resulting array contains the result of execution for each frame where the injection succeeded.
7633
7634
  */
7634
- export function executeScript<Args extends any[]>(injection: ScriptInjection<Args>, callback?: (results: InjectionResult[]) => void): void;
7635
+ export function executeScript<Args extends any[], Result>(injection: ScriptInjection<Args, Result>, callback?: (results: InjectionResult<Awaited<Result>>[]) => void): void;
7635
7636
 
7636
7637
  /**
7637
7638
  * Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.
@@ -9350,7 +9351,7 @@ declare namespace chrome.tabs {
9350
9351
  * Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).
9351
9352
  * @return The `getCurrent` method provides its result via callback or returned as a `Promise` (MV3 only).
9352
9353
  */
9353
- export function getCurrent(): Promise<Tab>;
9354
+ export function getCurrent(): Promise<Tab | undefined>;
9354
9355
  /**
9355
9356
  * Gets the tab that is selected in the specified window.
9356
9357
  * @deprecated since Chrome 33. Please use tabs.query {active: true}.
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.190",
3
+ "version": "0.0.193",
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",
@@ -93,6 +93,6 @@
93
93
  "@types/filesystem": "*",
94
94
  "@types/har-format": "*"
95
95
  },
96
- "typesPublisherContentHash": "6f2e02de6caa082b31f21f5ef80017ad305259fe8ab2ab27ae1b1a886fbbaec4",
97
- "typeScriptVersion": "3.9"
96
+ "typesPublisherContentHash": "5b4b19a45af72fa27d09cf5ab83b562d2063984b64c182f7836f54e52c39561e",
97
+ "typeScriptVersion": "4.0"
98
98
  }