Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(build): type definitions for context menu
Elian Doran23d01ec35113
diff --git a/src/public/app/menus/tree_context_menu.ts b/src/public/app/menus/tree_context_menu.tsindex 96872b4842..5c2c74fe9e 100644--- a/src/public/app/menus/tree_context_menu.ts+++ b/src/public/app/menus/tree_context_menu.ts@@ -18,7 +18,9 @@ interface ConvertToAttachmentResponse {attachment?: FAttachment;}-type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData>;+// This will include all commands that implement ContextMenuCommandData, but it will not work if it additional options are added via the `|` operator,+// so they need to be added manually.+export type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData> | "openBulkActionsDialog";export default class TreeContextMenu implements SelectMenuItemEventListener<TreeCommandNames> {private treeWidget: NoteTreeWidget;diff --git a/src/public/app/services/note_types.ts b/src/public/app/services/note_types.tsindex fc6e7bed6b..9c6af3b5ce 100644--- a/src/public/app/services/note_types.ts+++ b/src/public/app/services/note_types.ts@@ -2,12 +2,10 @@ import server from "./server.js";import froca from "./froca.js";import { t } from "./i18n.js";import type { MenuItem } from "../menus/context_menu.js";-import type { ContextMenuCommandData, FilteredCommandNames } from "../components/app_context.js";+import type { TreeCommandNames } from "../menus/tree_context_menu.js";-type NoteTypeCommandNames = FilteredCommandNames<ContextMenuCommandData>;--async function getNoteTypeItems(command?: NoteTypeCommandNames) {- const items: MenuItem<NoteTypeCommandNames>[] = [+async function getNoteTypeItems(command?: TreeCommandNames) {+ const items: MenuItem<TreeCommandNames>[] = [{ title: t("note_types.text"), command, type: "text", uiIcon: "bx bx-note" },{ title: t("note_types.code"), command, type: "code", uiIcon: "bx bx-code" },{ title: t("note_types.saved-search"), command, type: "search", uiIcon: "bx bx-file-find" },