Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
252 changes: 93 additions & 159 deletions types/chrome/index.d.ts

Large diffs are not rendered by default.

164 changes: 124 additions & 40 deletions types/chrome/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3632,46 +3632,119 @@ function testEnterpriseHardwarePlatform() {
chrome.enterprise.hardwarePlatform.getHardwarePlatformInfo((info) => {}).then((info) => {});
}

// https://developer.chrome.com/docs/extensions/reference/browsingData
// https://developer.chrome.com/docs/extensions/reference/api/browsingData
function testBrowsingData() {
const removalOptions: chrome.browsingData.RemovalOptions = {
excludeOrigins: [],
originTypes: {
extension: true,
protectedWeb: true,
unprotectedWeb: true,
},
origins: ["https://example.com"],
since: 0,
};

const dataTypeSet: chrome.browsingData.DataTypeSet = {
appcache: true,
cache: true,
cacheStorage: true,
cookies: true,
downloads: true,
fileSystems: true,
formData: true,
history: true,
indexedDB: true,
localStorage: true,
passwords: true,
pluginData: true,
serviceWorkers: true,
webSQL: true,
};

chrome.browsingData.remove(removalOptions, dataTypeSet); // $ExpectType Promise<void>
chrome.browsingData.remove(removalOptions, dataTypeSet, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeServiceWorkers();
chrome.browsingData.removeServiceWorkers({});
chrome.browsingData.removeServiceWorkers({}, () => {});
chrome.browsingData.settings((result) => {});
chrome.browsingData.removePluginData({}, () => {});
chrome.browsingData.removeServiceWorkers({}, () => {});
chrome.browsingData.removeFormData({}, () => {});
chrome.browsingData.removeFileSystems({}, () => {});
chrome.browsingData.remove({}, {}, () => {});
chrome.browsingData.removePasswords({}, () => {});
chrome.browsingData.removeCookies({}, () => {});
chrome.browsingData.removeWebSQL({}, () => {});
chrome.browsingData.removeAppcache({}, () => {});
chrome.browsingData.removeCacheStorage({}, () => {});
chrome.browsingData.removeDownloads({}, () => {});
chrome.browsingData.removeCache({}, () => {});
chrome.browsingData.removeHistory({}, () => {});
chrome.browsingData.removeIndexedDB({}, () => {});
}
chrome.browsingData.remove(removalOptions, dataTypeSet, () => {}).then(() => {});

// https://developer.chrome.com/docs/extensions/reference/browsingData
async function testBrowsingDataForPromise() {
await chrome.browsingData.settings();
await chrome.browsingData.removePluginData({});
await chrome.browsingData.removeServiceWorkers({});
await chrome.browsingData.removeFormData({});
await chrome.browsingData.removeFileSystems({});
await chrome.browsingData.remove({}, {});
await chrome.browsingData.removePasswords({});
await chrome.browsingData.removeCookies({});
await chrome.browsingData.removeWebSQL({});
await chrome.browsingData.removeAppcache({});
await chrome.browsingData.removeCacheStorage({});
await chrome.browsingData.removeDownloads({});
await chrome.browsingData.removeCache({});
await chrome.browsingData.removeHistory({});
await chrome.browsingData.removeIndexedDB({});
chrome.browsingData.removeAppcache(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeAppcache(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeAppcache(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeCache(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeCache(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeCache(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeCacheStorage(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeCacheStorage(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeCacheStorage(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeCookies(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeCookies(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeCookies(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeDownloads(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeDownloads(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeDownloads(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeFileSystems(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeFileSystems(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeFileSystems(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeFormData(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeFormData(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeFormData(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeHistory(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeHistory(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeHistory(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeIndexedDB(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeIndexedDB(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeIndexedDB(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeLocalStorage(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeLocalStorage(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeLocalStorage(removalOptions, () => {}).then(() => {});

chrome.browsingData.removePasswords(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removePasswords(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removePasswords(removalOptions, () => {}).then(() => {});

chrome.browsingData.removePluginData(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removePluginData(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removePluginData(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeServiceWorkers(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeServiceWorkers(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeServiceWorkers(removalOptions, () => {}).then(() => {});

chrome.browsingData.removeWebSQL(removalOptions); // $ExpectType Promise<void>
chrome.browsingData.removeWebSQL(removalOptions, () => {}); // $ExpectType void
// @ts-expect-error
chrome.browsingData.removeWebSQL(removalOptions, () => {}).then(() => {});

chrome.browsingData.settings(); // $ExpectType Promise<SettingsResult>
chrome.browsingData.settings((result) => { // $ExpectType void
result.dataRemovalPermitted; // $ExpectType DataTypeSet
result.dataToRemove; // $ExpectType DataTypeSet
result.options; // $ExpectType RemovalOptions
});
// @ts-expect-error
chrome.browsingData.settings((result) => {}).then((result) => {});
}

// https://developer.chrome.com/docs/extensions/reference/api/certificateProvider
Expand Down Expand Up @@ -3760,10 +3833,21 @@ function testCertificateProvider() {
});
}

// https://developer.chrome.com/docs/extensions/reference/commands
// https://developer.chrome.com/docs/extensions/reference/api/commands
async function testCommands() {
await chrome.commands.getAll();
chrome.commands.getAll((commands) => {});
chrome.commands.getAll(); // $ExpectType Promise<Command[]>
chrome.commands.getAll(([command]) => { // $ExpectType void
command.description; // $ExpectType string | undefined
command.name; // $ExpectType string | undefined
command.shortcut; // $ExpectType string | undefined
});
// @ts-expect-error
chrome.commands.getAll(() => {}).then(() => {});

checkChromeEvent(chrome.commands.onCommand, (command, tab) => {
command; // $ExpectType string
tab; // $ExpectType Tab | undefined
});
}

// https://developer.chrome.com/docs/extensions/reference/i18n
Expand Down
5 changes: 5 additions & 0 deletions types/chromecast-caf-receiver/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"@definitelytyped/no-const-enum": "off"
}
}
6 changes: 3 additions & 3 deletions types/chromecast-caf-receiver/cast.framework.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export import system = system;
export import messages = messages;

export as namespace framework;
export enum LoggerLevel {
export const enum LoggerLevel {
DEBUG = 0,
VERBOSE = 500,
INFO = 800,
Expand All @@ -24,7 +24,7 @@ export enum LoggerLevel {
* Content protection type.
* @see https://developers.google.com/cast/docs/reference/web_receiver/cast.framework#.ContentProtection
*/
export enum ContentProtection {
export const enum ContentProtection {
NONE = "none",
CLEARKEY = "clearkey",
PLAYREADY = "playready",
Expand Down Expand Up @@ -997,7 +997,7 @@ export class NetworkRequestInfo {
*
* @see https://developers.google.com/cast/docs/reference/web_receiver/cast.framework#.ShakaVariant
*/
export enum ShakaVariant {
export const enum ShakaVariant {
/**
* The standard, default build.
*/
Expand Down
6 changes: 3 additions & 3 deletions types/chromecast-caf-receiver/cast.framework.events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export as namespace events;
* Player event types for @see{@link framework.PlayerManager}.
* https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.events#.EventType
*/
export enum EventType {
export const enum EventType {
ALL = "*",
ABORT = "ABORT",
CAN_PLAY = "CAN_PLAY",
Expand Down Expand Up @@ -97,7 +97,7 @@ export enum EventType {
TRACKS_CHANGED = "TRACKS_CHANGED",
}

export enum DetailedErrorCode {
export const enum DetailedErrorCode {
MEDIA_UNKNOWN = 100,
MEDIA_ABORTED = 101,
MEDIA_DECODE = 102,
Expand Down Expand Up @@ -144,7 +144,7 @@ export enum DetailedErrorCode {
* The error severity. Follows the same naming scheme and numbering as Shaka Player.
* https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.events#.EventType
*/
export enum ErrorSeverity {
export const enum ErrorSeverity {
RECOVERABLE = 1,
CRITICAL = 2,
}
Expand Down
Loading