Skip to content

Commit 4c9ce2d

Browse files
committed
Don't use 'as any' when checking open view
1 parent 868ffd7 commit 4c9ce2d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

extensions/ql-vscode/src/model-editor/model-editor-view.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { CancellationTokenSource, Uri, ViewColumn, window } from "vscode";
1+
import {
2+
CancellationTokenSource,
3+
TabInputWebview,
4+
Uri,
5+
ViewColumn,
6+
window,
7+
} from "vscode";
28
import {
39
AbstractWebview,
410
WebviewPanelConfig,
@@ -151,7 +157,9 @@ export class ModelEditorView extends AbstractWebview<
151157
private isAModelEditorOpen(): boolean {
152158
return window.tabGroups.all.some((tabGroup) =>
153159
tabGroup.tabs.some((tab) => {
154-
const viewType: string | undefined = (tab.input as any)?.viewType;
160+
const viewType =
161+
tab.input instanceof TabInputWebview ? tab.input.viewType : undefined;
162+
155163
// The viewType has a prefix, such as "mainThreadWebview-", but if the
156164
// suffix matches that should be enough to identify the view.
157165
return viewType && viewType.endsWith("model-editor");
@@ -162,7 +170,9 @@ export class ModelEditorView extends AbstractWebview<
162170
private isAModelEditorActive(): boolean {
163171
return window.tabGroups.all.some((tabGroup) =>
164172
tabGroup.tabs.some((tab) => {
165-
const viewType: string | undefined = (tab.input as any)?.viewType;
173+
const viewType =
174+
tab.input instanceof TabInputWebview ? tab.input.viewType : undefined;
175+
166176
// The viewType has a prefix, such as "mainThreadWebview-", but if the
167177
// suffix matches that should be enough to identify the view.
168178
return viewType && viewType.endsWith("model-editor") && tab.isActive;

0 commit comments

Comments
 (0)