Skip to content

Commit adcacd7

Browse files
committed
Tighten tab role type.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent b6729b0 commit adcacd7

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

app/common/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ export interface ServerConf {
1717
icon: string;
1818
}
1919

20+
export type TabRole = "server" | "function";
21+
2022
export interface TabData {
21-
role: string;
23+
role: TabRole;
2224
name: string;
2325
index: number;
2426
webviewName: string;

app/renderer/js/components/tab.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import type {TabRole} from "../../../common/types";
2+
13
import type WebView from "./webview";
24

35
export interface TabProps {
4-
role: string;
6+
role: TabRole;
57
icon?: string;
68
name: string;
79
$root: Element;

app/renderer/js/components/webview.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import path from "path";
55
import * as ConfigUtil from "../../../common/config-util";
66
import {HTML, html} from "../../../common/html";
77
import type {RendererMessage} from "../../../common/typed-ipc";
8+
import type {TabRole} from "../../../common/types";
89
import {ipcRenderer} from "../typed-ipc-renderer";
910
import * as SystemUtil from "../utils/system-util";
1011

@@ -21,7 +22,7 @@ interface WebViewProps {
2122
index: number;
2223
tabIndex: number;
2324
url: string;
24-
role: string;
25+
role: TabRole;
2526
name: string;
2627
isActive: () => boolean;
2728
switchLoading: (loading: boolean, url: string) => void;

0 commit comments

Comments
 (0)