@types/chrome 0.1.13 → 0.1.15

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 +176 -224
  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: Mon, 29 Sep 2025 19:02:13 GMT
11
+ * Last updated: Tue, 30 Sep 2025 18:02:49 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
@@ -6881,54 +6881,42 @@ declare namespace chrome {
6881
6881
  * Permissions: "management"
6882
6882
  */
6883
6883
  export namespace management {
6884
+ /**
6885
+ * A reason the item is disabled.
6886
+ * @since Chrome 44
6887
+ */
6888
+ export enum ExtensionDisabledReason {
6889
+ UNKNOWN = "unknown",
6890
+ PERMISSIONS_INCREASE = "permissions_increase",
6891
+ }
6892
+
6884
6893
  /** Information about an installed extension, app, or theme. */
6885
6894
  export interface ExtensionInfo {
6886
- /**
6887
- * Optional.
6888
- * A reason the item is disabled.
6889
- * @since Chrome 17
6890
- */
6891
- disabledReason?: string | undefined;
6892
- /** Optional. The launch url (only present for apps). */
6893
- appLaunchUrl?: string | undefined;
6894
- /**
6895
- * The description of this extension, app, or theme.
6896
- * @since Chrome 9
6897
- */
6895
+ /** A reason the item is disabled. */
6896
+ disabledReason?: `${ExtensionDisabledReason}`;
6897
+ /** The launch url (only present for apps). */
6898
+ appLaunchUrl?: string;
6899
+ /** The description of this extension, app, or theme. */
6898
6900
  description: string;
6899
- /**
6900
- * Returns a list of API based permissions.
6901
- * @since Chrome 9
6902
- */
6901
+ /** Returns a list of API based permissions. */
6903
6902
  permissions: string[];
6904
- /**
6905
- * Optional.
6906
- * A list of icon information. Note that this just reflects what was declared in the manifest, and the actual image at that url may be larger or smaller than what was declared, so you might consider using explicit width and height attributes on img tags referencing these images. See the manifest documentation on icons for more details.
6907
- */
6908
- icons?: IconInfo[] | undefined;
6909
- /**
6910
- * Returns a list of host based permissions.
6911
- * @since Chrome 9
6912
- */
6903
+ /** A list of icon information. Note that this just reflects what was declared in the manifest, and the actual image at that url may be larger or smaller than what was declared, so you might consider using explicit width and height attributes on img tags referencing these images. See the manifest documentation on icons for more details. */
6904
+ icons?: IconInfo[];
6905
+ /** Returns a list of host based permissions. */
6913
6906
  hostPermissions: string[];
6914
6907
  /** Whether it is currently enabled or disabled. */
6915
6908
  enabled: boolean;
6916
- /**
6917
- * Optional.
6918
- * The URL of the homepage of this extension, app, or theme.
6919
- * @since Chrome 11
6920
- */
6921
- homepageUrl?: string | undefined;
6922
- /**
6923
- * Whether this extension can be disabled or uninstalled by the user.
6924
- * @since Chrome 12
6925
- */
6909
+ /** The URL of the homepage of this extension, app, or theme. */
6910
+ homepageUrl?: string;
6911
+ /** Whether this extension can be disabled or uninstalled by the user. */
6926
6912
  mayDisable: boolean;
6927
6913
  /**
6928
- * How the extension was installed.
6929
- * @since Chrome 22
6914
+ * Whether this extension can be enabled by the user. This is only returned for extensions which are not enabled.
6915
+ * @since Chrome 62
6930
6916
  */
6931
- installType: string;
6917
+ mayEnable?: boolean;
6918
+ /** How the extension was installed. */
6919
+ installType: `${ExtensionInstallType}`;
6932
6920
  /** The version of this extension, app, or theme. */
6933
6921
  version: string;
6934
6922
  /**
@@ -6938,266 +6926,217 @@ declare namespace chrome {
6938
6926
  versionName?: string;
6939
6927
  /** The extension's unique identifier. */
6940
6928
  id: string;
6941
- /**
6942
- * Whether the extension, app, or theme declares that it supports offline.
6943
- * @since Chrome 15
6944
- */
6929
+ /** Whether the extension, app, or theme declares that it supports offline. */
6945
6930
  offlineEnabled: boolean;
6946
- /**
6947
- * Optional.
6948
- * The update URL of this extension, app, or theme.
6949
- * @since Chrome 16
6950
- */
6951
- updateUrl?: string | undefined;
6952
- /**
6953
- * The type of this extension, app, or theme.
6954
- * @since Chrome 23
6955
- */
6956
- type: string;
6931
+ /** The update URL of this extension, app, or theme. */
6932
+ updateUrl?: string;
6933
+ /** The type of this extension, app, or theme. */
6934
+ type: `${ExtensionType}`;
6957
6935
  /** The url for the item's options page, if it has one. */
6958
6936
  optionsUrl: string;
6959
6937
  /** The name of this extension, app, or theme. */
6960
6938
  name: string;
6961
- /**
6962
- * A short version of the name of this extension, app, or theme.
6963
- * @since Chrome 31
6964
- */
6939
+ /** A short version of the name of this extension, app, or theme. */
6965
6940
  shortName: string;
6966
6941
  /**
6967
6942
  * True if this is an app.
6968
- * @deprecated since Chrome 33. Please use management.ExtensionInfo.type.
6943
+ * @deprecated since Chrome 33. Please use {@link management.ExtensionInfo.type}.
6969
6944
  */
6970
6945
  isApp: boolean;
6971
- /**
6972
- * Optional.
6973
- * The app launch type (only present for apps).
6974
- * @since Chrome 37
6975
- */
6976
- launchType?: string | undefined;
6977
- /**
6978
- * Optional.
6979
- * The currently available launch types (only present for apps).
6980
- * @since Chrome 37
6981
- */
6982
- availableLaunchTypes?: string[] | undefined;
6946
+ /** The app launch type (only present for apps). */
6947
+ launchType?: `${LaunchType}`;
6948
+ /** The currently available launch types (only present for apps). */
6949
+ availableLaunchTypes?: `${LaunchType}`[];
6950
+ }
6951
+
6952
+ /**
6953
+ * How the extension was installed
6954
+ * @since Chrome 44
6955
+ */
6956
+ export enum ExtensionInstallType {
6957
+ /** The extension was installed because of an administrative policy. */
6958
+ ADMIN = "admin",
6959
+ /** The extension was loaded unpacked in developer mode. */
6960
+ DEVELOPMENT = "development",
6961
+ /** The extension was installed normally via a .crx file. */
6962
+ NORMAL = "normal",
6963
+ /** The extension was installed by other software on the machine. */
6964
+ SIDELOAD = "sideload",
6965
+ /** The extension was installed by other means. */
6966
+ OTHER = "other",
6967
+ }
6968
+
6969
+ /**
6970
+ * The type of this extension, app, or theme.
6971
+ * @since Chrome 44
6972
+ */
6973
+ export enum ExtensionType {
6974
+ EXTENSION = "extension",
6975
+ HOSTED_APP = "hosted_app",
6976
+ PACKAGE_APP = "package_app",
6977
+ LEGACY_PACKAGED_APP = "legacy_packaged_app",
6978
+ THEME = "theme",
6979
+ LOGIN_SCREEN_EXTENSION = "login_screen_extension",
6983
6980
  }
6984
6981
 
6985
6982
  /** Information about an icon belonging to an extension, app, or theme. */
6986
6983
  export interface IconInfo {
6987
- /** The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append ?grayscale=true to the URL. */
6984
+ /** The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append `?grayscale=true` to the URL. */
6988
6985
  url: string;
6989
6986
  /** A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, and 16. */
6990
6987
  size: number;
6991
6988
  }
6992
6989
 
6990
+ /** These are all possible app launch types. */
6991
+ export enum LaunchType {
6992
+ OPEN_AS_REGULAR_TAB = "OPEN_AS_REGULAR_TAB",
6993
+ OPEN_AS_PINNED_TAB = "OPEN_AS_PINNED_TAB",
6994
+ OPEN_AS_WINDOW = "OPEN_AS_WINDOW",
6995
+ OPEN_FULL_SCREEN = "OPEN_FULL_SCREEN",
6996
+ }
6997
+
6998
+ /**
6999
+ * Options for how to handle the extension's uninstallation.
7000
+ * @since Chrome 88
7001
+ */
6993
7002
  export interface UninstallOptions {
6994
- /**
6995
- * Optional.
6996
- * Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false for self uninstalls. If an extension uninstalls another extension, this parameter is ignored and the dialog is always shown.
6997
- */
7003
+ /** Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false for self uninstalls. If an extension uninstalls another extension, this parameter is ignored and the dialog is always shown. */
6998
7004
  showConfirmDialog?: boolean | undefined;
6999
7005
  }
7000
7006
 
7001
- export interface ManagementDisabledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {}
7002
-
7003
- export interface ManagementUninstalledEvent extends chrome.events.Event<(id: string) => void> {}
7004
-
7005
- export interface ManagementInstalledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {}
7006
-
7007
- export interface ManagementEnabledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {}
7008
-
7009
7007
  /**
7010
- * Enables or disables an app or extension.
7011
- * @param id This should be the id from an item of management.ExtensionInfo.
7008
+ * Enables or disables an app or extension. In most cases this function must be called in the context of a user gesture (e.g. an onclick handler for a button), and may present the user with a native confirmation UI as a way of preventing abuse.
7009
+ *
7010
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7011
+ * @param id This should be the id from an item of {@link management.ExtensionInfo}.
7012
7012
  * @param enabled Whether this item should be enabled or disabled.
7013
- * @return The `setEnabled` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7014
7013
  */
7015
7014
  export function setEnabled(id: string, enabled: boolean): Promise<void>;
7016
- /**
7017
- * Enables or disables an app or extension.
7018
- * @param id This should be the id from an item of management.ExtensionInfo.
7019
- * @param enabled Whether this item should be enabled or disabled.
7020
- */
7021
7015
  export function setEnabled(id: string, enabled: boolean, callback: () => void): void;
7016
+
7022
7017
  /**
7023
7018
  * Returns a list of permission warnings for the given extension id.
7024
- * @since Chrome 15
7019
+ *
7020
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7025
7021
  * @param id The ID of an already installed extension.
7026
- * @return The `getPermissionWarningsById` method provides its result via callback or returned as a `Promise` (MV3 only).
7027
7022
  */
7028
7023
  export function getPermissionWarningsById(id: string): Promise<string[]>;
7029
- /**
7030
- * Returns a list of permission warnings for the given extension id.
7031
- * @since Chrome 15
7032
- * @param id The ID of an already installed extension.
7033
- */
7034
7024
  export function getPermissionWarningsById(id: string, callback: (permissionWarnings: string[]) => void): void;
7025
+
7035
7026
  /**
7036
7027
  * Returns information about the installed extension, app, or theme that has the given ID.
7037
- * @since Chrome 9
7038
- * @param id The ID from an item of management.ExtensionInfo.
7039
- * @return The `get` method provides its result via callback or returned as a `Promise` (MV3 only).
7028
+ *
7029
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7030
+ * @param id The ID from an item of {@link management.ExtensionInfo}.
7040
7031
  */
7041
7032
  export function get(id: string): Promise<ExtensionInfo>;
7042
- /**
7043
- * Returns information about the installed extension, app, or theme that has the given ID.
7044
- * @since Chrome 9
7045
- * @param id The ID from an item of management.ExtensionInfo.
7046
- */
7047
7033
  export function get(id: string, callback: (result: ExtensionInfo) => void): void;
7034
+
7048
7035
  /**
7049
7036
  * Returns a list of information about installed extensions and apps.
7050
- * @return The `getAll` method provides its result via callback or returned as a `Promise` (MV3 only).
7037
+ *
7038
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7051
7039
  */
7052
7040
  export function getAll(): Promise<ExtensionInfo[]>;
7053
- /**
7054
- * Returns a list of information about installed extensions and apps.
7055
- */
7056
7041
  export function getAll(callback: (result: ExtensionInfo[]) => void): void;
7042
+
7057
7043
  /**
7058
7044
  * Returns a list of permission warnings for the given extension manifest string. Note: This function can be used without requesting the 'management' permission in the manifest.
7059
- * @since Chrome 15
7060
- * @param manifestStr Extension manifest JSON string.
7061
- * @return The `getPermissionWarningsByManifest` method provides its result via callback or returned as a `Promise` (MV3 only).
7062
- */
7063
- export function getPermissionWarningsByManifest(
7064
- manifestStr: string,
7065
- ): Promise<string[]>;
7066
- /**
7067
- * Returns a list of permission warnings for the given extension manifest string. Note: This function can be used without requesting the 'management' permission in the manifest.
7068
- * @since Chrome 15
7045
+ *
7046
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7069
7047
  * @param manifestStr Extension manifest JSON string.
7070
7048
  */
7049
+ export function getPermissionWarningsByManifest(manifestStr: string): Promise<string[]>;
7071
7050
  export function getPermissionWarningsByManifest(
7072
7051
  manifestStr: string,
7073
- callback: (permissionwarnings: string[]) => void,
7052
+ callback: (permissionWarnings: string[]) => void,
7074
7053
  ): void;
7054
+
7075
7055
  /**
7076
7056
  * Launches an application.
7057
+ *
7058
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7077
7059
  * @param id The extension id of the application.
7078
- * @return The `launchApp` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7079
7060
  */
7080
7061
  export function launchApp(id: string): Promise<void>;
7081
- /**
7082
- * Launches an application.
7083
- * @param id The extension id of the application.
7084
- */
7085
7062
  export function launchApp(id: string, callback: () => void): void;
7063
+
7086
7064
  /**
7087
- * Uninstalls a currently installed app or extension.
7088
- * @since Chrome 21
7089
- * @param id This should be the id from an item of management.ExtensionInfo.
7090
- * @return The `uninstall` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7065
+ * Uninstalls a currently installed app or extension. Note: This function does not work in managed environments when the user is not allowed to uninstall the specified extension/app. If the uninstall fails (e.g. the user cancels the dialog) the promise will be rejected or the callback will be called with {@link runtime.lastError} set.
7066
+ *
7067
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7068
+ * @param id This should be the id from an item of {@link management.ExtensionInfo}.
7091
7069
  */
7092
7070
  export function uninstall(id: string, options?: UninstallOptions): Promise<void>;
7093
- /**
7094
- * Uninstalls a currently installed app or extension.
7095
- * @since Chrome 21
7096
- * @param id This should be the id from an item of management.ExtensionInfo.
7097
- */
7098
- export function uninstall(id: string, callback: () => void): void;
7099
- export function uninstall(id: string, options: UninstallOptions, callback: () => void): void;
7100
- /**
7101
- * Uninstalls a currently installed app or extension.
7102
- * @deprecated since Chrome 21. The options parameter was added to this function.
7103
- * @param id This should be the id from an item of management.ExtensionInfo.
7104
- * @return The `uninstall` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7105
- */
7106
- export function uninstall(id: string): Promise<void>;
7107
- /**
7108
- * Uninstalls a currently installed app or extension.
7109
- * @deprecated since Chrome 21. The options parameter was added to this function.
7110
- * @param id This should be the id from an item of management.ExtensionInfo.
7111
- */
7112
7071
  export function uninstall(id: string, callback: () => void): void;
7072
+ export function uninstall(id: string, options: UninstallOptions | undefined, callback: () => void): void;
7073
+
7113
7074
  /**
7114
7075
  * Returns information about the calling extension, app, or theme. Note: This function can be used without requesting the 'management' permission in the manifest.
7115
- * @since Chrome 39
7116
- * @return The `getSelf` method provides its result via callback or returned as a `Promise` (MV3 only).
7076
+ *
7077
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7117
7078
  */
7118
7079
  export function getSelf(): Promise<ExtensionInfo>;
7119
- /**
7120
- * Returns information about the calling extension, app, or theme. Note: This function can be used without requesting the 'management' permission in the manifest.
7121
- * @since Chrome 39
7122
- */
7123
7080
  export function getSelf(callback: (result: ExtensionInfo) => void): void;
7081
+
7124
7082
  /**
7125
- * Uninstalls the calling extension.
7126
- * Note: This function can be used without requesting the 'management' permission in the manifest.
7127
- * @since Chrome 26
7128
- * @return The `uninstallSelf` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7129
- */
7130
- export function uninstallSelf(options?: UninstallOptions): Promise<void>;
7131
- /**
7132
- * Uninstalls the calling extension.
7133
- * Note: This function can be used without requesting the 'management' permission in the manifest.
7134
- * @since Chrome 26
7135
- */
7136
- export function uninstallSelf(callback: () => void): void;
7137
- export function uninstallSelf(options: UninstallOptions, callback: () => void): void;
7138
- /**
7139
- * Uninstalls the calling extension.
7140
- * Note: This function can be used without requesting the 'management' permission in the manifest.
7141
- * @since Chrome 26
7142
- * @return The `uninstallSelf` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7083
+ * Launches the replacement_web_app specified in the manifest. Prompts the user to install if not already installed.
7084
+ *
7085
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7086
+ * @since Chrome 77
7143
7087
  */
7144
- export function uninstallSelf(): Promise<void>;
7088
+ export function installReplacementWebApp(): Promise<void>;
7089
+ export function installReplacementWebApp(callback: () => void): void;
7090
+
7145
7091
  /**
7146
- * Uninstalls the calling extension.
7147
- * Note: This function can be used without requesting the 'management' permission in the manifest.
7148
- * @since Chrome 26
7092
+ * Uninstalls the calling extension. Note: This function can be used without requesting the 'management' permission in the manifest. This function does not work in managed environments when the user is not allowed to uninstall the specified extension/app.
7093
+ *
7094
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7149
7095
  */
7096
+ export function uninstallSelf(options?: UninstallOptions): Promise<void>;
7150
7097
  export function uninstallSelf(callback: () => void): void;
7098
+ export function uninstallSelf(options: UninstallOptions | undefined, callback: () => void): void;
7099
+
7151
7100
  /**
7152
7101
  * Display options to create shortcuts for an app. On Mac, only packaged app shortcuts can be created.
7153
- * @since Chrome 37
7154
- * @return The `createAppShortcut` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7102
+ *
7103
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7104
+ * @param id This should be the id from an app item of {@link management.ExtensionInfo}.
7155
7105
  */
7156
7106
  export function createAppShortcut(id: string): Promise<void>;
7157
- /**
7158
- * Display options to create shortcuts for an app. On Mac, only packaged app shortcuts can be created.
7159
- * @since Chrome 37
7160
- */
7161
7107
  export function createAppShortcut(id: string, callback: () => void): void;
7108
+
7162
7109
  /**
7163
7110
  * Set the launch type of an app.
7164
- * @since Chrome 37
7165
- * @param id This should be the id from an app item of management.ExtensionInfo.
7166
- * @param launchType The target launch type. Always check and make sure this launch type is in ExtensionInfo.availableLaunchTypes, because the available launch types vary on different platforms and configurations.
7167
- * @return The `setLaunchType` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
7168
- */
7169
- export function setLaunchType(id: string, launchType: string): Promise<void>;
7170
- /**
7171
- * Set the launch type of an app.
7172
- * @since Chrome 37
7173
- * @param id This should be the id from an app item of management.ExtensionInfo.
7174
- * @param launchType The target launch type. Always check and make sure this launch type is in ExtensionInfo.availableLaunchTypes, because the available launch types vary on different platforms and configurations.
7111
+ *
7112
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7113
+ * @param id This should be the id from an app item of {@link management.ExtensionInfo}.
7114
+ * @param launchType The target launch type. Always check and make sure this launch type is in {@link ExtensionInfo.availableLaunchTypes}, because the available launch types vary on different platforms and configurations.
7175
7115
  */
7176
- export function setLaunchType(id: string, launchType: string, callback: () => void): void;
7116
+ export function setLaunchType(id: string, launchType: `${LaunchType}`): Promise<void>;
7117
+ export function setLaunchType(id: string, launchType: `${LaunchType}`, callback: () => void): void;
7118
+
7177
7119
  /**
7178
7120
  * Generate an app for a URL. Returns the generated bookmark app.
7179
- * @since Chrome 37
7121
+ *
7122
+ * Can return its result via Promise in Manifest V3 or later since Chrome 88.
7180
7123
  * @param url The URL of a web page. The scheme of the URL can only be "http" or "https".
7181
7124
  * @param title The title of the generated app.
7182
- * @return The `generateAppForLink` method provides its result via callback or returned as a `Promise` (MV3 only).
7183
7125
  */
7184
7126
  export function generateAppForLink(url: string, title: string): Promise<ExtensionInfo>;
7185
- /**
7186
- * Generate an app for a URL. Returns the generated bookmark app.
7187
- * @since Chrome 37
7188
- * @param url The URL of a web page. The scheme of the URL can only be "http" or "https".
7189
- * @param title The title of the generated app.
7190
- */
7191
7127
  export function generateAppForLink(url: string, title: string, callback: (result: ExtensionInfo) => void): void;
7192
7128
 
7193
7129
  /** Fired when an app or extension has been disabled. */
7194
- export var onDisabled: ManagementDisabledEvent;
7130
+ export const onDisabled: events.Event<(info: ExtensionInfo) => void>;
7131
+
7195
7132
  /** Fired when an app or extension has been uninstalled. */
7196
- export var onUninstalled: ManagementUninstalledEvent;
7133
+ export const onUninstalled: events.Event<(id: string) => void>;
7134
+
7197
7135
  /** Fired when an app or extension has been installed. */
7198
- export var onInstalled: ManagementInstalledEvent;
7136
+ export const onInstalled: events.Event<(info: ExtensionInfo) => void>;
7137
+
7199
7138
  /** Fired when an app or extension has been enabled. */
7200
- export var onEnabled: ManagementEnabledEvent;
7139
+ export const onEnabled: events.Event<(info: ExtensionInfo) => void>;
7201
7140
  }
7202
7141
 
7203
7142
  ////////////////////
@@ -8627,29 +8566,42 @@ declare namespace chrome {
8627
8566
  * @since Chrome 87
8628
8567
  */
8629
8568
  export namespace search {
8630
- export type Disposition = "CURRENT_TAB" | "NEW_TAB" | "NEW_WINDOW";
8631
-
8632
- export interface QueryInfo {
8633
- /** Location where search results should be displayed. CURRENT_TAB is the default. */
8634
- disposition?: Disposition | undefined;
8635
- /** Location where search results should be displayed. tabIdcannot be used with disposition. */
8636
- tabId?: number | undefined;
8637
- /** String to query with the default search provider. */
8638
- text?: string | undefined;
8569
+ export enum Disposition {
8570
+ /** Specifies that the search results display in the calling tab or the tab from the active browser. */
8571
+ CURRENT_TAB = "CURRENT_TAB",
8572
+ /** Specifies that the search results display in a new tab. */
8573
+ NEW_TAB = "NEW_TAB",
8574
+ /** Specifies that the search results display in a new window. */
8575
+ NEW_WINDOW = "NEW_WINDOW",
8639
8576
  }
8640
8577
 
8641
- /**
8642
- * Used to query the default search provider. In case of an error, runtime.lastError will be set.
8643
- * @param options search configuration options.
8644
- */
8645
- export function query(options: QueryInfo, callback: () => void): void;
8578
+ export type QueryInfo =
8579
+ & {
8580
+ /** String to query with the default search provider. */
8581
+ text?: string | undefined;
8582
+ }
8583
+ & (
8584
+ | {
8585
+ /** Location where search results should be displayed. `CURRENT_TAB` is the default. */
8586
+ disposition?: `${Disposition}` | undefined;
8587
+ /** Location where search results should be displayed. `tabId` cannot be used with `disposition`. */
8588
+ tabId?: undefined;
8589
+ }
8590
+ | {
8591
+ /** Location where search results should be displayed. `CURRENT_TAB` is the default. */
8592
+ disposition?: undefined;
8593
+ /** Location where search results should be displayed. `tabId` cannot be used with `disposition`. */
8594
+ tabId?: number | undefined;
8595
+ }
8596
+ );
8646
8597
 
8647
8598
  /**
8648
- * Used to query the default search provider. In case of an error, runtime.lastError will be set.
8649
- * @param options search configuration options.
8650
- * @return The `query` method provides its result via callback or returned as a `Promise` (MV3 only). It has no parameters.
8599
+ * Used to query the default search provider. In case of an error, {@link runtime.lastError} will be set.
8600
+ *
8601
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
8651
8602
  */
8652
8603
  export function query(options: QueryInfo): Promise<void>;
8604
+ export function query(options: QueryInfo, callback: () => void): void;
8653
8605
  }
8654
8606
 
8655
8607
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
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": "e9a8cff02c9f22c9b5091b4453e8560fb0f276e53c0fda367c1d5ff929553b95",
97
+ "typesPublisherContentHash": "764f93eaa7f8d4f7669f091cdfd73ad4db83ad84cfed3c9220152a9a35030761",
98
98
  "typeScriptVersion": "5.2"
99
99
  }