From 8cc271a192449014d5eacf47de8afb0a75acce0c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 26 Oct 2024 10:29:15 +0300 Subject: [PATCH] client: Fix a few TypeScript build errors --- src/public/app/components/app_context.ts | 2 ++ src/public/app/services/load_results.ts | 2 +- src/public/app/services/utils.ts | 7 ++++--- src/public/app/services/ws.ts | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts index 12ffbe4cc..6372d43ce 100644 --- a/src/public/app/components/app_context.ts +++ b/src/public/app/components/app_context.ts @@ -28,7 +28,9 @@ interface BeforeUploadListener extends Component { } interface TriggerData { + noteId?: string; noteIds?: string[]; + messages?: unknown[]; callback?: () => void; } diff --git a/src/public/app/services/load_results.ts b/src/public/app/services/load_results.ts index 8a9781f87..7945a943e 100644 --- a/src/public/app/services/load_results.ts +++ b/src/public/app/services/load_results.ts @@ -82,7 +82,7 @@ export default class LoadResults { this.componentIdToNoteIds[componentId] = this.componentIdToNoteIds[componentId] || []; - if (!this.componentIdToNoteIds[componentId]) { + if (this.componentIdToNoteIds[componentId]) { this.componentIdToNoteIds[componentId].push(noteId); } } diff --git a/src/public/app/services/utils.ts b/src/public/app/services/utils.ts index 0d4bb748b..a9776ff85 100644 --- a/src/public/app/services/utils.ts +++ b/src/public/app/services/utils.ts @@ -1,4 +1,5 @@ import dayjs from "dayjs"; +import bootstrap from "bootstrap"; function reloadFrontendApp(reason?: string) { if (reason) { @@ -517,10 +518,10 @@ function createImageSrcUrl(note: { noteId: string; title: string }) { /** * Given a string representation of an SVG, triggers a download of the file on the client device. * - * @param {string} nameWithoutExtension the name of the file. The .svg suffix is automatically added to it. - * @param {string} svgContent the content of the SVG file download. + * @param nameWithoutExtension the name of the file. The .svg suffix is automatically added to it. + * @param svgContent the content of the SVG file download. */ -function downloadSvg(nameWithoutExtension, svgContent) { +function downloadSvg(nameWithoutExtension: string, svgContent: string) { const filename = `${nameWithoutExtension}.svg`; const element = document.createElement('a'); element.setAttribute('href', `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svgContent)}`); diff --git a/src/public/app/services/ws.ts b/src/public/app/services/ws.ts index e39f033d8..86f047dae 100644 --- a/src/public/app/services/ws.ts +++ b/src/public/app/services/ws.ts @@ -5,6 +5,7 @@ import options from "./options.js"; import frocaUpdater from "./froca_updater.js"; import appContext from "../components/app_context.js"; import { EntityChange } from '../../../services/entity_changes_interface.js'; +import { t } from './i18n.js'; type MessageHandler = (message: any) => void; const messageHandlers: MessageHandler[] = [];