mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server-ts: Implement review comments
This commit is contained in:
parent
8af5434462
commit
1e91db865b
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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--) {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user