From f272b462a1c0d84268b73b2f0c4e2e26c2bcb054 Mon Sep 17 00:00:00 2001 From: Erwan Jugand <47392755+erwanjugand@users.noreply.github.com> Date: Wed, 19 Nov 2025 21:42:46 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74112=20[chrome]?= =?UTF-8?q?=20fix=20StorageArea=20type=20with=20union=20by=20@erwanjugand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/chrome/index.d.ts | 4 ---- types/chrome/test/index.ts | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index f03401d0d3491d..4e003752125805 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -10047,10 +10047,8 @@ declare namespace chrome { * * Can return its result via Promise in Manifest V3 or later since Chrome 95. */ - getBytesInUse(keys: never[]): Promise<0>; getBytesInUse(keys?: keyof T | Array | null): Promise; getBytesInUse(callback: (bytesInUse: number) => void): void; - getBytesInUse(keys: never[], callback: (bytesInUse: 0) => void): void; getBytesInUse( keys: keyof T | Array | null | undefined, callback: (bytesInUse: number) => void, @@ -10088,12 +10086,10 @@ declare namespace chrome { * * Can return its result via Promise in Manifest V3 or later since Chrome 95. */ - get(keys: never[] | Record): Promise<{ [key: string]: never }>; get( keys?: NoInferX | Array> | Partial> | null, ): Promise; get(callback: (items: T) => void): void; - get(keys: never[] | Record, callback: (items: { [key: string]: never }) => void): void; get( keys: NoInferX | Array> | Partial> | null | undefined, callback: (items: T) => void, diff --git a/types/chrome/test/index.ts b/types/chrome/test/index.ts index 71b46b56a3ab8e..0e717d95ce8d95 100644 --- a/types/chrome/test/index.ts +++ b/types/chrome/test/index.ts @@ -1374,9 +1374,7 @@ function testStorage() { chrome.storage[area].get(); // $ExpectType Promise<{ [key: string]: unknown; }> chrome.storage[area].get(null); // $ExpectType Promise<{ [key: string]: unknown; }> chrome.storage[area].get(key); // $ExpectType Promise<{ [key: string]: unknown; }> - chrome.storage[area].get([]); // $ExpectType Promise<{ [key: string]: never; }> chrome.storage[area].get([key]); // $ExpectType Promise<{ [key: string]: unknown; }> - chrome.storage[area].get({}); // $ExpectType Promise<{ [key: string]: never; }> chrome.storage[area].get({ key }); // $ExpectType Promise<{ [key: string]: unknown; }> chrome.storage[area].get(badKey); // $ExpectType Promise<{ [key: string]: unknown; }> chrome.storage[area].get(key); // $ExpectType Promise @@ -1389,18 +1387,12 @@ function testStorage() { chrome.storage[area].get(key, (items) => { // $ExpectType void items; // $ExpectType { [key: string]: unknown; } }); - chrome.storage[area].get([], (items) => { // $ExpectType void - items; // $ExpectType { [key: string]: never; } - }); chrome.storage[area].get([key], (items) => { // $ExpectType void items; // $ExpectType { [key: string]: unknown; } }); chrome.storage[area].get({ key }, (items) => { // $ExpectType void items; // $ExpectType { [key: string]: unknown; } }); - chrome.storage[area].get({}, (items) => { // $ExpectType void - items; // $ExpectType { [key: string]: never; } - }); chrome.storage[area].get(badKey, (items) => { // $ExpectType void items; // $ExpectType { [key: string]: unknown; } }); @@ -1416,7 +1408,6 @@ function testStorage() { chrome.storage[area].getBytesInUse(null); // $ExpectType Promise chrome.storage[area].getBytesInUse(key); // $ExpectType Promise chrome.storage[area].getBytesInUse([key]); // $ExpectType Promise - chrome.storage[area].getBytesInUse([]); // $ExpectType Promise<0> chrome.storage[area].getBytesInUse(badKey); // $ExpectType Promise chrome.storage[area].getBytesInUse(key); // $ExpectType Promise chrome.storage[area].getBytesInUse(key); // $ExpectType Promise @@ -1432,9 +1423,6 @@ function testStorage() { chrome.storage[area].getBytesInUse([key], (bytesInUse) => { // $ExpectType void bytesInUse; // $ExpectType number }); - chrome.storage[area].getBytesInUse([], (bytesInUse) => { // $ExpectType void - bytesInUse; // $ExpectType 0 - }); chrome.storage[area].getBytesInUse(badKey, (bytesInUse) => { // $ExpectType void bytesInUse; // $ExpectType number });