Skip to content

Commit 23d01ec

Browse files
committed
fix(build): type definitions for context menu
1 parent 7874e88 commit 23d01ec

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/public/app/menus/tree_context_menu.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ interface ConvertToAttachmentResponse {
1818
attachment?: FAttachment;
1919
}
2020

21-
type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData>;
21+
// This will include all commands that implement ContextMenuCommandData, but it will not work if it additional options are added via the `|` operator,
22+
// so they need to be added manually.
23+
export type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData> | "openBulkActionsDialog";
2224

2325
export default class TreeContextMenu implements SelectMenuItemEventListener<TreeCommandNames> {
2426
private treeWidget: NoteTreeWidget;

src/public/app/services/note_types.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import server from "./server.js";
22
import froca from "./froca.js";
33
import { t } from "./i18n.js";
44
import type { MenuItem } from "../menus/context_menu.js";
5-
import type { ContextMenuCommandData, FilteredCommandNames } from "../components/app_context.js";
5+
import type { TreeCommandNames } from "../menus/tree_context_menu.js";
66

7-
type NoteTypeCommandNames = FilteredCommandNames<ContextMenuCommandData>;
8-
9-
async function getNoteTypeItems(command?: NoteTypeCommandNames) {
10-
const items: MenuItem<NoteTypeCommandNames>[] = [
7+
async function getNoteTypeItems(command?: TreeCommandNames) {
8+
const items: MenuItem<TreeCommandNames>[] = [
119
{ title: t("note_types.text"), command, type: "text", uiIcon: "bx bx-note" },
1210
{ title: t("note_types.code"), command, type: "code", uiIcon: "bx bx-code" },
1311
{ title: t("note_types.saved-search"), command, type: "search", uiIcon: "bx bx-file-find" },

0 commit comments

Comments
 (0)