Skip to content

Commit d2c58e7

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[cleanup] Types
Bug: none Change-Id: I1cc9e234ff00346fa429aef31aee3d95f11e4d11 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6448689 Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
1 parent 704729c commit d2c58e7

File tree

7 files changed

+10
-18
lines changed

7 files changed

+10
-18
lines changed

extension-api/ExtensionAPI.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
export namespace Chrome {
66
export namespace DevTools {
7-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8-
export interface EventSink<ListenerT extends(...args: any) => void> {
7+
export interface EventSink<ListenerT extends(...args: any[]) => void> {
98
addListener(listener: ListenerT): void;
109
removeListener(listener: ListenerT): void;
1110
}

front_end/core/common/ResourceType.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,7 @@ export class ResourceType {
220220
}
221221

222222
static fromName(name: string): ResourceType|null {
223-
for (const resourceTypeId in resourceTypes) {
224-
const resourceType = (resourceTypes as {
225-
[x: string]: ResourceType,
226-
})[resourceTypeId];
223+
for (const resourceType of Object.values(resourceTypes)) {
227224
if (resourceType.name() === name) {
228225
return resourceType;
229226
}
@@ -427,7 +424,7 @@ export const resourceTypes = {
427424
SourceMapStyleSheet:
428425
new ResourceType('sm-stylesheet', i18nLazyString(UIStrings.stylesheet), resourceCategories.Stylesheet, true),
429426
WebBundle: new ResourceType('webbundle', i18nLazyString(UIStrings.webbundle), resourceCategories.Other, false),
430-
};
427+
} as const;
431428

432429
const mimeTypeByName = new Map([
433430
// CoffeeScript

front_end/core/host/InspectorFrontendHost.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ class InspectorFrontendAPIImpl {
568568
}
569569
}
570570

571-
private dispatch(name: symbol, signature: string[], _runOnceLoaded: boolean, ...params: string[]): void {
571+
private dispatch(name: Events, signature: string[], _runOnceLoaded: boolean, ...params: string[]): void {
572572
// Single argument methods get dispatched with the param.
573573
if (signature.length < 2) {
574574
try {
@@ -579,9 +579,7 @@ class InspectorFrontendAPIImpl {
579579
}
580580
return;
581581
}
582-
const data: {
583-
[x: string]: string,
584-
} = {};
582+
const data: Record<string, string> = {};
585583
for (let i = 0; i < signature.length; ++i) {
586584
data[signature[i]] = params[i];
587585
}

front_end/core/host/InspectorFrontendHostAPI.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const EventDescriptors = [
6767
[Events.SetInspectedTabId, 'setInspectedTabId', ['tabId']],
6868
[Events.SetUseSoftMenu, 'setUseSoftMenu', ['useSoftMenu']],
6969
[Events.ShowPanel, 'showPanel', ['panelName']],
70-
];
70+
] as const;
7171

7272
export interface DispatchMessageChunkEvent {
7373
messageChunk: string;

front_end/entrypoints/formatter_worker/ESTreeWalker.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ export class ESTreeWalker {
4444
// @ts-expect-error We are doing type traversal here, but the strings
4545
// in _walkOrder are not mapping. Preferably, we would use the
4646
// properties as defined in the types, but we can't do that yet.
47-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
48-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49-
const entity = (node[walkOrder[i]] as any);
47+
const entity = node[walkOrder[i]];
5048
if (Array.isArray(entity)) {
5149
this.#walkArray((entity as Acorn.ESTree.Node[]), node);
5250
} else {

front_end/ui/legacy/components/color_picker/Spectrum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
13981398
// Wait for TypeScript to support the definition of EyeDropper API:
13991399
// https://github.com/microsoft/TypeScript/issues/48638
14001400
/* eslint-disable @typescript-eslint/no-explicit-any */
1401-
const eyeDropper = new (<any>window).EyeDropper();
1401+
const eyeDropper = new (window as any).EyeDropper();
14021402
this.eyeDropperAbortController = new AbortController();
14031403

14041404
try {

front_end/ui/legacy/components/data_grid/SortableDataGrid.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class SortableDataGrid<T> extends ViewportDataGrid<SortableDataGridNode<T
6060
return null;
6161
}
6262

63-
const columns = ([] as ColumnDescriptor[]);
63+
const columns: ColumnDescriptor[] = [];
6464
for (let i = 0; i < columnNames.length; ++i) {
6565
const id = String(i);
6666
columns.push(({id, title: columnNames[i], sortable: true} as ColumnDescriptor));
@@ -78,7 +78,7 @@ export class SortableDataGrid<T> extends ViewportDataGrid<SortableDataGridNode<T
7878
nodes.push(node);
7979
}
8080

81-
const dataGrid = new SortableDataGrid(({displayName, columns} as Parameters));
81+
const dataGrid = new SortableDataGrid({displayName, columns});
8282
const length = nodes.length;
8383
const rootNode = dataGrid.rootNode();
8484
for (let i = 0; i < length; ++i) {

0 commit comments

Comments
 (0)