Skip to content

Build your personal knowledge base with Trilium Notes

chore(client/ts): fix build errors

Elian Doranffa463f1fce6
diff --git a/src/public/app/types.d.ts b/src/public/app/types.d.ts
index 774985177a..cab82d1032 100644
--- a/src/public/app/types.d.ts
+++ b/src/public/app/types.d.ts
@@ -95,7 +95,7 @@ declare global {
className: string;
separateWordSearch: boolean;
caseSensitive: boolean;
- done: () => void;
+ done?: () => void;
});
unmark(opts?: {
done: () => void;
diff --git a/src/public/app/widgets/find.ts b/src/public/app/widgets/find.ts
index c208128fbb..2505c5a854 100644
--- a/src/public/app/widgets/find.ts
+++ b/src/public/app/widgets/find.ts
@@ -305,7 +305,10 @@ export default class FindWidget extends NoteContextAwareWidget {
const matchCase = this.$caseSensitiveCheckbox.prop("checked");
const wholeWord = this.$matchWordsCheckbox.prop("checked");
- const { totalFound, currentFound } = await this.handler?.performFind(searchTerm, matchCase, wholeWord);
+ if (!this.handler) {
+ return;
+ }
+ const { totalFound, currentFound } = await this.handler.performFind(searchTerm, matchCase, wholeWord);
this.$totalFound.text(totalFound);
this.$currentFound.text(currentFound);
diff --git a/src/public/app/widgets/find_in_code.ts b/src/public/app/widgets/find_in_code.ts
index d29cd67ce9..63081bb0be 100644
--- a/src/public/app/widgets/find_in_code.ts
+++ b/src/public/app/widgets/find_in_code.ts
@@ -38,7 +38,7 @@ export default class FindInCode {
// See https://codemirror.net/addon/search/searchcursor.js for tips
const codeEditor = await this.getCodeEditor();
if (!codeEditor) {
- return;
+ return { totalFound: 0, currentFound: 0 };
}
const doc = codeEditor.doc;