[cleanup] Type title of View and SimpleView as LocalizedString
Drive-by: Remove unnecessary cast.
[email protected]
Fixed: 1311532
Change-Id: I29388a801e7d8d62571cc9578aef8a28c18893b0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3560432
Reviewed-by: Alex Rudenko <[email protected]>
Auto-Submit: Simon Zünd <[email protected]>
Commit-Queue: Simon Zünd <[email protected]>
diff --git a/front_end/ui/legacy/View.ts b/front_end/ui/legacy/View.ts
index b012293..ca49eb5 100644
--- a/front_end/ui/legacy/View.ts
+++ b/front_end/ui/legacy/View.ts
@@ -2,15 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import type * as Platform from '../../core/platform/platform.js';
+
import type {TabbedPane} from './TabbedPane.js';
import type {ToolbarItem, ToolbarMenuButton} from './Toolbar.js';
import {ViewManager} from './ViewManager.js';
import type {Widget} from './Widget.js';
import {VBox} from './Widget.js';
+
export interface View {
viewId(): string;
- title(): string;
+ title(): Platform.UIString.LocalizedString;
isCloseable(): boolean;
@@ -26,12 +29,12 @@
}
export class SimpleView extends VBox implements View {
- private readonly titleInternal: string;
+ readonly #title: Platform.UIString.LocalizedString;
readonly #viewId: string;
- constructor(title: string, isWebComponent?: boolean, viewId?: string) {
+ constructor(title: Platform.UIString.LocalizedString, isWebComponent?: boolean, viewId?: string) {
super(isWebComponent);
- this.titleInternal = title;
+ this.#title = title;
this.#viewId = viewId ?? title;
}
@@ -39,8 +42,8 @@
return this.#viewId;
}
- title(): string {
- return this.titleInternal;
+ title(): Platform.UIString.LocalizedString {
+ return this.#title;
}
isCloseable(): boolean {
@@ -56,7 +59,7 @@
}
widget(): Promise<Widget> {
- return (Promise.resolve(this) as Promise<Widget>);
+ return Promise.resolve(this);
}
revealView(): Promise<void> {