Skip to content

Build your personal knowledge base with Trilium Notes

server-ts: Implement review comments

Elian Doran1e91db865bfb
diff --git a/src/becca/becca-interface.ts b/src/becca/becca-interface.ts
index a18dc9432f..4c82187972 100644
--- a/src/becca/becca-interface.ts
+++ b/src/becca/becca-interface.ts
@@ -68,7 +68,7 @@ class Becca {
}
findAttributesWithPrefix(type: string, name: string): BAttribute[] {
- const resArr = [];
+ const resArr: BAttribute[][] = [];
const key = `${type}-${name}`;
for (const idx in this.attributeIndex) {
@@ -105,7 +105,7 @@ class Becca {
}
getNotes(noteIds: string[], ignoreMissing: boolean = false): BNote[] {
- const filteredNotes = [];
+ const filteredNotes: BNote[] = [];
for (const noteId of noteIds) {
const note = this.notes[noteId];
diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js
index 40e898659e..fc8e80aefb 100644
--- a/src/services/backend_script_api.js
+++ b/src/services/backend_script_api.js
@@ -678,7 +678,7 @@ function BackendScriptApi(currentNote, apiParams) {
/**
* This object contains "at your risk" and "no BC guarantees" objects for advanced use cases.
*
- * @property {Becca} becca - provides access to the backend in-memory object graph, see {@link https://github.com/zadam/trilium/blob/master/src/becca/becca}
+ * @property {Becca} becca - provides access to the backend in-memory object graph, see {@link https://github.com/zadam/trilium/blob/master/src/becca/becca.js}
*/
this.__private = {
becca
diff --git a/src/services/encryption/data_encryption.ts b/src/services/encryption/data_encryption.ts
index c19008a5b1..b82a0e8c6a 100644
--- a/src/services/encryption/data_encryption.ts
+++ b/src/services/encryption/data_encryption.ts
@@ -3,7 +3,7 @@
import crypto = require('crypto');
import log = require('../log');
-function arraysIdentical(a: Buffer, b: Buffer) {
+function arraysIdentical(a: any[] | Buffer, b: any[] | Buffer) {
let i = a.length;
if (i !== b.length) return false;
while (i--) {
diff --git a/src/services/search/note_set.ts b/src/services/search/note_set.ts
index d53d00e4d1..47c644c38c 100644
--- a/src/services/search/note_set.ts
+++ b/src/services/search/note_set.ts
@@ -4,9 +4,10 @@ import BNote = require("../../becca/entities/bnote");
class NoteSet {
- private notes: BNote[];
private noteIdSet: Set<string>;
- private sorted: boolean;
+
+ notes: BNote[];
+ sorted: boolean;
constructor(notes: BNote[] = []) {
this.notes = notes;
diff --git a/src/services/sql.ts b/src/services/sql.ts
index ffc15a99d8..f0a9d7d291 100644
--- a/src/services/sql.ts
+++ b/src/services/sql.ts
@@ -157,10 +157,10 @@ function iterateRows(query: string, params: Params = []) {
function getMap<K extends string | number | symbol, V>(query: string, params: Params = []) {
const map: Record<K, V> = {} as Record<K, V>;
- const results = getRawRows<any>(query, params);
+ const results = getRawRows<[K, V]>(query, params);
for (const row of results || []) {
- map[row[0] as K] = row[1];
+ map[row[0]] = row[1];
}
return map;