Skip to content

Commit 4c38110

Browse files
authored
🤖 Merge PR DefinitelyTyped#72257 [Chrome] update permisions and optional_permissions lists by @erwanjugand
1 parent 5dc6503 commit 4c38110

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

‎types/chrome/index.d.ts‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8956,7 +8956,7 @@ declare namespace chrome {
89568956
default_popup?: string | undefined;
89578957
}
89588958

8959-
// Source: https://developer.chrome.com/docs/extensions/mv3/declare_permissions/
8959+
/** Source: https://developer.chrome.com/docs/extensions/reference/permissions-list */
89608960
export type ManifestPermissions =
89618961
| "accessibilityFeatures.modify"
89628962
| "accessibilityFeatures.read"
@@ -9013,11 +9013,11 @@ declare namespace chrome {
90139013
| "privacy"
90149014
| "processes"
90159015
| "proxy"
9016+
| "readingList"
90169017
| "scripting"
90179018
| "search"
90189019
| "sessions"
90199020
| "sidePanel"
9020-
| "signedInDevices"
90219021
| "storage"
90229022
| "system.cpu"
90239023
| "system.display"
@@ -9040,6 +9040,23 @@ declare namespace chrome {
90409040
| "webRequestBlocking"
90419041
| "webRequestAuthProvider";
90429042

9043+
/** Source : https://developer.chrome.com/docs/extensions/reference/api/permissions */
9044+
export type ManifestOptionalPermissions = Exclude<
9045+
ManifestPermissions,
9046+
| "debugger"
9047+
| "declarativeNetRequest"
9048+
| "devtools"
9049+
| "experimental"
9050+
| "fontSettings"
9051+
| "geolocation"
9052+
| "proxy"
9053+
| "tts"
9054+
| "ttsEngine"
9055+
| "unlimitedStorage"
9056+
| "wallpaper"
9057+
| "webAuthenticationProxy"
9058+
>;
9059+
90439060
export interface SearchProvider {
90449061
name?: string | undefined;
90459062
keyword?: string | undefined;
@@ -9259,8 +9276,8 @@ declare namespace chrome {
92599276
}
92609277
| undefined;
92619278
content_security_policy?: string | undefined;
9262-
optional_permissions?: string[] | undefined;
9263-
permissions?: string[] | undefined;
9279+
optional_permissions?: ManifestOptionalPermissions[] | string[] | undefined;
9280+
permissions?: ManifestPermissions[] | string[] | undefined;
92649281
web_accessible_resources?: string[] | undefined;
92659282
}
92669283

@@ -9295,7 +9312,7 @@ declare namespace chrome {
92959312
sandbox?: string;
92969313
};
92979314
host_permissions?: string[] | undefined;
9298-
optional_permissions?: ManifestPermissions[] | undefined;
9315+
optional_permissions?: ManifestOptionalPermissions[] | undefined;
92999316
optional_host_permissions?: string[] | undefined;
93009317
permissions?: ManifestPermissions[] | undefined;
93019318
web_accessible_resources?: Array<{ resources: string[]; matches: string[] }> | undefined;

‎types/chrome/test/index.ts‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ function testGetManifest() {
731731
manifest.content_security_policy; // $ExpectType string | undefined
732732

733733
manifest.host_permissions; // $ExpectType any
734-
manifest.optional_permissions; // $ExpectType string[] | undefined
735-
manifest.permissions; // $ExpectType string[] | undefined
734+
manifest.optional_permissions; // $ExpectType ManifestOptionalPermissions[] | string[] | undefined
735+
manifest.permissions; // $ExpectType ManifestPermissions[] |string[] | undefined
736736

737737
manifest.web_accessible_resources; // $ExpectType string[] | undefined
738738
} else if (manifest.manifest_version === 3) {
@@ -746,13 +746,38 @@ function testGetManifest() {
746746
};
747747

748748
manifest.host_permissions; // $ExpectType string[] | undefined
749-
manifest.optional_permissions; // $ExpectType ManifestPermissions[] | undefined
749+
manifest.optional_permissions; // $ExpectType ManifestOptionalPermissions[] | undefined
750750
manifest.optional_host_permissions; // $ExpectType string[] | undefined
751751
manifest.permissions; // $ExpectType ManifestPermissions[] | undefined
752752

753753
manifest.web_accessible_resources = [{ matches: ["https://*/*"], resources: ["resource.js"] }];
754754
// @ts-expect-error
755755
manifest.web_accessible_resources = ["script.js"];
756+
757+
// @ts-expect-error Permission 'debugger' cannot be listed as optional. This permission will be omitted.
758+
manifest.optional_permissions = ["debugger"];
759+
// @ts-expect-error Permission 'declarativeNetRequest' cannot be listed as optional. This permission will be omitted.
760+
manifest.optional_permissions = ["declarativeNetRequest"];
761+
// @ts-expect-error Permission 'devtools' cannot be listed as optional. This permission will be omitted.
762+
manifest.optional_permissions = ["devtools"];
763+
// @ts-expect-error Permission 'experimental' cannot be listed as optional. This permission will be omitted.
764+
manifest.optional_permissions = ["experimental"];
765+
// @ts-expect-error Permission 'fontSettings' cannot be listed as optional. This permission will be omitted.
766+
manifest.optional_permissions = ["fontSettings"];
767+
// @ts-expect-error Permission 'geolocation' cannot be listed as optional. This permission will be omitted.
768+
manifest.optional_permissions = ["geolocation"];
769+
// @ts-expect-error Permission 'proxy' cannot be listed as optional. This permission will be omitted.
770+
manifest.optional_permissions = ["proxy"];
771+
// @ts-expect-error Permission 'tts' cannot be listed as optional. This permission will be omitted.
772+
manifest.optional_permissions = ["tts"];
773+
// @ts-expect-error Permission 'ttsEngine' cannot be listed as optional. This permission will be omitted.
774+
manifest.optional_permissions = ["ttsEngine"];
775+
// @ts-expect-error Permission 'unlimitedStorage' cannot be listed as optional. This permission will be omitted.
776+
manifest.optional_permissions = ["unlimitedStorage"];
777+
// @ts-expect-error Permission 'wallpaper' cannot be listed as optional. This permission will be omitted.
778+
manifest.optional_permissions = ["wallpaper"];
779+
// @ts-expect-error Permission 'webAuthenticationProxy' cannot be listed as optional. This permission will be omitted.
780+
manifest.optional_permissions = ["webAuthenticationProxy"];
756781
}
757782

758783
const mv2: chrome.runtime.Manifest = {

0 commit comments

Comments
 (0)