mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-03 13:33:18 +00:00
xo: Fix @typescript-eslint/consistent-type-definitions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -16,11 +16,11 @@ import crypto from "node:crypto";
|
||||
// don’t leak anything from the user’s clipboard other than the token
|
||||
// intended for us.
|
||||
|
||||
export interface ClipboardDecrypter {
|
||||
export type ClipboardDecrypter = {
|
||||
version: number;
|
||||
key: Uint8Array;
|
||||
pasted: Promise<string>;
|
||||
}
|
||||
};
|
||||
|
||||
export class ClipboardDecrypterImpl implements ClipboardDecrypter {
|
||||
version: number;
|
||||
|
||||
@@ -5,9 +5,9 @@ import {generateNodeFromHtml} from "./base";
|
||||
import type {TabProps} from "./tab";
|
||||
import Tab from "./tab";
|
||||
|
||||
export interface FunctionalTabProps extends TabProps {
|
||||
export type FunctionalTabProps = {
|
||||
$view: Element;
|
||||
}
|
||||
} & TabProps;
|
||||
|
||||
export default class FunctionalTab extends Tab {
|
||||
$view: Element;
|
||||
|
||||
@@ -9,9 +9,9 @@ import type {TabProps} from "./tab";
|
||||
import Tab from "./tab";
|
||||
import type WebView from "./webview";
|
||||
|
||||
export interface ServerTabProps extends TabProps {
|
||||
export type ServerTabProps = {
|
||||
webview: Promise<WebView>;
|
||||
}
|
||||
} & TabProps;
|
||||
|
||||
export default class ServerTab extends Tab {
|
||||
webview: Promise<WebView>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type {TabRole} from "../../../common/types";
|
||||
|
||||
export interface TabProps {
|
||||
export type TabProps = {
|
||||
role: TabRole;
|
||||
icon?: string;
|
||||
name: string;
|
||||
@@ -12,7 +12,7 @@ export interface TabProps {
|
||||
onHoverOut?: () => void;
|
||||
materialIcon?: string;
|
||||
onDestroy?: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
export default abstract class Tab {
|
||||
abstract $el: Element;
|
||||
|
||||
@@ -19,7 +19,7 @@ import {contextMenu} from "./context-menu";
|
||||
|
||||
const shouldSilentWebview = ConfigUtil.getConfigItem("silent", false);
|
||||
|
||||
interface WebViewProps {
|
||||
type WebViewProps = {
|
||||
$root: Element;
|
||||
rootWebContents: WebContents;
|
||||
index: number;
|
||||
@@ -32,7 +32,7 @@ interface WebViewProps {
|
||||
preload?: string;
|
||||
onTitleChange: () => void;
|
||||
hasPermission?: (origin: string, permission: string) => boolean;
|
||||
}
|
||||
};
|
||||
|
||||
export default class WebView {
|
||||
static templateHtml(props: WebViewProps): Html {
|
||||
|
||||
@@ -8,7 +8,7 @@ import {ipcRenderer} from "./typed-ipc-renderer";
|
||||
|
||||
type ListenerType = (...args: any[]) => void;
|
||||
|
||||
export interface ElectronBridge {
|
||||
export type ElectronBridge = {
|
||||
send_event: (eventName: string | symbol, ...args: unknown[]) => boolean;
|
||||
on_event: (eventName: string, listener: ListenerType) => void;
|
||||
new_notification: (
|
||||
@@ -21,7 +21,7 @@ export interface ElectronBridge {
|
||||
get_send_notification_reply_message_supported: () => boolean;
|
||||
set_send_notification_reply_message_supported: (value: boolean) => void;
|
||||
decrypt_clipboard: (version: number) => ClipboardDecrypter;
|
||||
}
|
||||
};
|
||||
|
||||
let notificationReplySupported = false;
|
||||
// Indicates if the user is idle or not
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
type ElectronBridge = import("./electron-bridge").ElectronBridge;
|
||||
|
||||
interface CompatElectronBridge extends ElectronBridge {
|
||||
type CompatElectronBridge = {
|
||||
readonly idle_on_system: boolean;
|
||||
readonly last_active_on_system: number;
|
||||
send_notification_reply_message_supported: boolean;
|
||||
}
|
||||
} & ElectronBridge;
|
||||
|
||||
(() => {
|
||||
const zulipWindow = window as typeof window & {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {ipcRenderer} from "../typed-ipc-renderer";
|
||||
|
||||
export interface NotificationData {
|
||||
export type NotificationData = {
|
||||
close: () => void;
|
||||
title: string;
|
||||
dir: NotificationDirection;
|
||||
@@ -9,7 +9,7 @@ export interface NotificationData {
|
||||
tag: string;
|
||||
icon: string;
|
||||
data: unknown;
|
||||
}
|
||||
};
|
||||
|
||||
export function newNotification(
|
||||
title: string,
|
||||
|
||||
@@ -3,12 +3,12 @@ import {html} from "../../../../common/html";
|
||||
import {generateNodeFromHtml} from "../../components/base";
|
||||
import {ipcRenderer} from "../../typed-ipc-renderer";
|
||||
|
||||
interface BaseSectionProps {
|
||||
type BaseSectionProps = {
|
||||
$element: HTMLElement;
|
||||
disabled?: boolean;
|
||||
value: boolean;
|
||||
clickHandler: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
export function generateSettingOption(props: BaseSectionProps): void {
|
||||
const {$element, disabled, value, clickHandler} = props;
|
||||
|
||||
@@ -7,9 +7,9 @@ import {reloadApp} from "./base-section";
|
||||
import {initFindAccounts} from "./find-accounts";
|
||||
import {initServerInfoForm} from "./server-info-form";
|
||||
|
||||
interface ConnectedOrgSectionProps {
|
||||
type ConnectedOrgSectionProps = {
|
||||
$root: Element;
|
||||
}
|
||||
};
|
||||
|
||||
export function initConnectedOrgSection({
|
||||
$root,
|
||||
|
||||
@@ -3,9 +3,9 @@ import * as LinkUtil from "../../../../common/link-util";
|
||||
import * as t from "../../../../common/translation-util";
|
||||
import {generateNodeFromHtml} from "../../components/base";
|
||||
|
||||
interface FindAccountsProps {
|
||||
type FindAccountsProps = {
|
||||
$root: Element;
|
||||
}
|
||||
};
|
||||
|
||||
async function findAccounts(url: string): Promise<void> {
|
||||
if (!url) {
|
||||
|
||||
@@ -20,9 +20,9 @@ import {generateSelectHtml, generateSettingOption} from "./base-section";
|
||||
|
||||
const currentBrowserWindow = remote.getCurrentWindow();
|
||||
|
||||
interface GeneralSectionProps {
|
||||
type GeneralSectionProps = {
|
||||
$root: Element;
|
||||
}
|
||||
};
|
||||
|
||||
export function initGeneralSection({$root}: GeneralSectionProps): void {
|
||||
$root.innerHTML = html`
|
||||
|
||||
@@ -4,10 +4,10 @@ import * as t from "../../../../common/translation-util";
|
||||
import type {NavItem} from "../../../../common/types";
|
||||
import {generateNodeFromHtml} from "../../components/base";
|
||||
|
||||
interface PreferenceNavProps {
|
||||
type PreferenceNavProps = {
|
||||
$root: Element;
|
||||
onItemSelected: (navItem: NavItem) => void;
|
||||
}
|
||||
};
|
||||
|
||||
export default class PreferenceNav {
|
||||
navItems: NavItem[];
|
||||
|
||||
@@ -5,9 +5,9 @@ import {ipcRenderer} from "../../typed-ipc-renderer";
|
||||
|
||||
import {generateSettingOption} from "./base-section";
|
||||
|
||||
interface NetworkSectionProps {
|
||||
type NetworkSectionProps = {
|
||||
$root: Element;
|
||||
}
|
||||
};
|
||||
|
||||
export function initNetworkSection({$root}: NetworkSectionProps): void {
|
||||
$root.innerHTML = html`
|
||||
|
||||
@@ -7,10 +7,10 @@ import {generateNodeFromHtml} from "../../components/base";
|
||||
import {ipcRenderer} from "../../typed-ipc-renderer";
|
||||
import * as DomainUtil from "../../utils/domain-util";
|
||||
|
||||
interface NewServerFormProps {
|
||||
type NewServerFormProps = {
|
||||
$root: Element;
|
||||
onChange: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
export function initNewServerForm({$root, onChange}: NewServerFormProps): void {
|
||||
const $newServerForm = generateNodeFromHtml(html`
|
||||
|
||||
@@ -8,12 +8,12 @@ import {generateNodeFromHtml} from "../../components/base";
|
||||
import {ipcRenderer} from "../../typed-ipc-renderer";
|
||||
import * as DomainUtil from "../../utils/domain-util";
|
||||
|
||||
interface ServerInfoFormProps {
|
||||
type ServerInfoFormProps = {
|
||||
$root: Element;
|
||||
server: ServerConf;
|
||||
index: number;
|
||||
onChange: () => void;
|
||||
}
|
||||
};
|
||||
|
||||
export function initServerInfoForm(props: ServerInfoFormProps): void {
|
||||
const $serverInfoForm = generateNodeFromHtml(html`
|
||||
|
||||
@@ -4,9 +4,9 @@ import * as t from "../../../../common/translation-util";
|
||||
import {reloadApp} from "./base-section";
|
||||
import {initNewServerForm} from "./new-server-form";
|
||||
|
||||
interface ServersSectionProps {
|
||||
type ServersSectionProps = {
|
||||
$root: Element;
|
||||
}
|
||||
};
|
||||
|
||||
export function initServersSection({$root}: ServersSectionProps): void {
|
||||
$root.innerHTML = html`
|
||||
|
||||
@@ -4,9 +4,9 @@ import {html} from "../../../../common/html";
|
||||
import * as LinkUtil from "../../../../common/link-util";
|
||||
import * as t from "../../../../common/translation-util";
|
||||
|
||||
interface ShortcutsSectionProps {
|
||||
type ShortcutsSectionProps = {
|
||||
$root: Element;
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
export function initShortcutsSection({$root}: ShortcutsSectionProps): void {
|
||||
|
||||
Reference in New Issue
Block a user