Skip to content

Commit f272b46

Browse files
authored
🤖 Merge PR DefinitelyTyped#74112 [chrome] fix StorageArea type with union by @erwanjugand
1 parent 10b16b0 commit f272b46

File tree

2 files changed

+0
-16
lines changed

2 files changed

+0
-16
lines changed

‎types/chrome/index.d.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10047,10 +10047,8 @@ declare namespace chrome {
1004710047
*
1004810048
* Can return its result via Promise in Manifest V3 or later since Chrome 95.
1004910049
*/
10050-
getBytesInUse(keys: never[]): Promise<0>;
1005110050
getBytesInUse<T = { [key: string]: any }>(keys?: keyof T | Array<keyof T> | null): Promise<number>;
1005210051
getBytesInUse<T = { [key: string]: any }>(callback: (bytesInUse: number) => void): void;
10053-
getBytesInUse(keys: never[], callback: (bytesInUse: 0) => void): void;
1005410052
getBytesInUse<T = { [key: string]: any }>(
1005510053
keys: keyof T | Array<keyof T> | null | undefined,
1005610054
callback: (bytesInUse: number) => void,
@@ -10088,12 +10086,10 @@ declare namespace chrome {
1008810086
*
1008910087
* Can return its result via Promise in Manifest V3 or later since Chrome 95.
1009010088
*/
10091-
get(keys: never[] | Record<string, never>): Promise<{ [key: string]: never }>;
1009210089
get<T = { [key: string]: unknown }>(
1009310090
keys?: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
1009410091
): Promise<T>;
1009510092
get<T = { [key: string]: unknown }>(callback: (items: T) => void): void;
10096-
get(keys: never[] | Record<string, never>, callback: (items: { [key: string]: never }) => void): void;
1009710093
get<T = { [key: string]: unknown }>(
1009810094
keys: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null | undefined,
1009910095
callback: (items: T) => void,

‎types/chrome/test/index.ts‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,9 +1374,7 @@ function testStorage() {
13741374
chrome.storage[area].get(); // $ExpectType Promise<{ [key: string]: unknown; }>
13751375
chrome.storage[area].get(null); // $ExpectType Promise<{ [key: string]: unknown; }>
13761376
chrome.storage[area].get(key); // $ExpectType Promise<{ [key: string]: unknown; }>
1377-
chrome.storage[area].get([]); // $ExpectType Promise<{ [key: string]: never; }>
13781377
chrome.storage[area].get([key]); // $ExpectType Promise<{ [key: string]: unknown; }>
1379-
chrome.storage[area].get({}); // $ExpectType Promise<{ [key: string]: never; }>
13801378
chrome.storage[area].get({ key }); // $ExpectType Promise<{ [key: string]: unknown; }>
13811379
chrome.storage[area].get(badKey); // $ExpectType Promise<{ [key: string]: unknown; }>
13821380
chrome.storage[area].get<StorageData>(key); // $ExpectType Promise<StorageData>
@@ -1389,18 +1387,12 @@ function testStorage() {
13891387
chrome.storage[area].get(key, (items) => { // $ExpectType void
13901388
items; // $ExpectType { [key: string]: unknown; }
13911389
});
1392-
chrome.storage[area].get([], (items) => { // $ExpectType void
1393-
items; // $ExpectType { [key: string]: never; }
1394-
});
13951390
chrome.storage[area].get([key], (items) => { // $ExpectType void
13961391
items; // $ExpectType { [key: string]: unknown; }
13971392
});
13981393
chrome.storage[area].get({ key }, (items) => { // $ExpectType void
13991394
items; // $ExpectType { [key: string]: unknown; }
14001395
});
1401-
chrome.storage[area].get({}, (items) => { // $ExpectType void
1402-
items; // $ExpectType { [key: string]: never; }
1403-
});
14041396
chrome.storage[area].get(badKey, (items) => { // $ExpectType void
14051397
items; // $ExpectType { [key: string]: unknown; }
14061398
});
@@ -1416,7 +1408,6 @@ function testStorage() {
14161408
chrome.storage[area].getBytesInUse(null); // $ExpectType Promise<number>
14171409
chrome.storage[area].getBytesInUse(key); // $ExpectType Promise<number>
14181410
chrome.storage[area].getBytesInUse([key]); // $ExpectType Promise<number>
1419-
chrome.storage[area].getBytesInUse([]); // $ExpectType Promise<0>
14201411
chrome.storage[area].getBytesInUse(badKey); // $ExpectType Promise<number>
14211412
chrome.storage[area].getBytesInUse<StorageData>(key); // $ExpectType Promise<number>
14221413
chrome.storage[area].getBytesInUse<StorageData>(key); // $ExpectType Promise<number>
@@ -1432,9 +1423,6 @@ function testStorage() {
14321423
chrome.storage[area].getBytesInUse([key], (bytesInUse) => { // $ExpectType void
14331424
bytesInUse; // $ExpectType number
14341425
});
1435-
chrome.storage[area].getBytesInUse([], (bytesInUse) => { // $ExpectType void
1436-
bytesInUse; // $ExpectType 0
1437-
});
14381426
chrome.storage[area].getBytesInUse(badKey, (bytesInUse) => { // $ExpectType void
14391427
bytesInUse; // $ExpectType number
14401428
});

0 commit comments

Comments
 (0)