From 4df599fec2e2d95b271d89afbc98a113438d0703 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 17 Feb 2024 11:54:41 +0200 Subject: [PATCH] server-ts: Fix some build errors --- src/becca/entities/battachment.ts | 7 ++++--- src/services/entity_changes_interface.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/becca/entities/battachment.ts b/src/becca/entities/battachment.ts index 0d301494e..84f7de5c1 100644 --- a/src/becca/entities/battachment.ts +++ b/src/becca/entities/battachment.ts @@ -96,7 +96,7 @@ class BAttachment extends AbstractBeccaEntity { /** @returns true if the note has string content (not binary) */ hasStringContent(): boolean { - return utils.isStringNote(this.type, this.mime); + return this.type !== undefined && utils.isStringNote(this.type, this.mime); } isContentAvailable() { @@ -135,7 +135,8 @@ class BAttachment extends AbstractBeccaEntity { } convertToNote(): { note: BNote, branch: BBranch } { - if (this.type === 'search') { + // FIXME: can this ever be "search"? + if (this.type as string === 'search') { throw new Error(`Note of type search cannot have child notes`); } @@ -157,7 +158,7 @@ class BAttachment extends AbstractBeccaEntity { const { note, branch } = noteService.createNewNote({ parentNoteId: this.ownerId, title: this.title, - type: attachmentRoleToNoteTypeMapping[this.role], + type: (attachmentRoleToNoteTypeMapping as any)[this.role], mime: this.mime, content: this.getContent(), isProtected: this.isProtected diff --git a/src/services/entity_changes_interface.ts b/src/services/entity_changes_interface.ts index f0a583e95..745a8a8fa 100644 --- a/src/services/entity_changes_interface.ts +++ b/src/services/entity_changes_interface.ts @@ -4,7 +4,7 @@ export interface EntityChange { entityName: string; entityId: string; entity?: any; - positions?: Record; + positions?: Record; hash: string; utcDateChanged?: string; isSynced: boolean | 1 | 0;