Skip to content

Build your personal knowledge base with Trilium Notes

chore(client/ts): port services/note_types

Elian Doran4505564f1374
diff --git a/src/public/app/services/note_types.js b/src/public/app/services/note_types.ts
similarity index 84%
rename from src/public/app/services/note_types.js
rename to src/public/app/services/note_types.ts
index 8bc30af6b3..2526821a82 100644
--- a/src/public/app/services/note_types.js
+++ b/src/public/app/services/note_types.ts
@@ -2,8 +2,18 @@ import server from "./server.js";
import froca from "./froca.js";
import { t } from "./i18n.js";
-async function getNoteTypeItems(command) {
- const items = [
+type NoteTypeItem = {
+ title: string;
+ command: string;
+ type: string;
+ uiIcon: string;
+ templateNoteId?: string;
+} | {
+ title: "----"
+};
+
+async function getNoteTypeItems(command: string) {
+ const items: NoteTypeItem[] = [
{ title: t("note_types.text"), command: command, type: "text", uiIcon: "bx bx-note" },
{ title: t("note_types.code"), command: command, type: "code", uiIcon: "bx bx-code" },
{ title: t("note_types.saved-search"), command: command, type: "search", uiIcon: "bx bx-file-find" },
@@ -17,7 +27,7 @@ async function getNoteTypeItems(command) {
{ title: t("note_types.mind-map"), command, type: "mindMap", uiIcon: "bx bx-sitemap" }
];
- const templateNoteIds = await server.get("search-templates");
+ const templateNoteIds = await server.get<string[]>("search-templates");
const templateNotes = await froca.getNotes(templateNoteIds);
if (templateNotes.length > 0) {