Skip to content

Build your personal knowledge base with Trilium Notes

chore: fix typecheck

Elian Dorana1f0615afe3a
diff --git a/apps/client/src/services/attributes.spec.ts b/apps/client/src/services/attributes.spec.ts
index 7a949eebc6..f9caa6906d 100644
--- a/apps/client/src/services/attributes.spec.ts
+++ b/apps/client/src/services/attributes.spec.ts
@@ -6,10 +6,8 @@ import froca from "./froca";
import server from "./server.js";
// Spy on server methods to track calls
-// @ts-expect-error the generic typing is causing issues here
-server.put = vi.fn(async <T> (url: string, data?: T) => ({} as T));
-// @ts-expect-error the generic typing is causing issues here
-server.remove = vi.fn(async <T> (url: string) => ({} as T));
+server.put = vi.fn(async () => ({})) as typeof server.put;
+server.remove = vi.fn(async () => ({})) as typeof server.remove;
describe("Set boolean with inheritance", () => {
beforeEach(() => {
diff --git a/apps/client/src/widgets/collections/board/data.spec.ts b/apps/client/src/widgets/collections/board/data.spec.ts
index b8f0f50341..316efbcba2 100644
--- a/apps/client/src/widgets/collections/board/data.spec.ts
+++ b/apps/client/src/widgets/collections/board/data.spec.ts
@@ -27,7 +27,7 @@ describe("Board data", () => {
froca.branches["note1_note2"] = branch;
froca.getNoteFromCache("note1")!.addChild("note2", "note1_note2", false);
const data = await getBoardData(parentNote, "status", {}, false);
- const noteIds = Array.from(data.byColumn.values()).flat().map(item => item.note.noteId);
+ const noteIds = [...data.byColumn.values()].flat().map(item => item.note.noteId);
expect(noteIds.length).toBe(3);
});
});
diff --git a/packages/commons/src/lib/utils.ts b/packages/commons/src/lib/utils.ts
index eb5ad3a674..c243f091b9 100644
--- a/packages/commons/src/lib/utils.ts
+++ b/packages/commons/src/lib/utils.ts
@@ -10,7 +10,7 @@ function getCircularReplacer() {
if (typeof value !== "object" || value === null) {
return value;
}
- while (ancestors.length > 0 && ancestors.at(-1) !== this) {
+ while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
ancestors.pop();
}
if (ancestors.includes(value)) {