Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(client): solve type errors
Elian Doran28266c5bd0b7
diff --git a/apps/client/src/services/froca-interface.ts b/apps/client/src/services/froca-interface.tsindex cfb3d076a8..156bc684a2 100644--- a/apps/client/src/services/froca-interface.ts+++ b/apps/client/src/services/froca-interface.ts@@ -9,7 +9,7 @@ export interface Froca {branches: Record<string, FBranch>;attributes: Record<string, FAttribute>;attachments: Record<string, FAttachment>;- blobPromises: Record<string, Promise<void | FBlob> | null>;+ blobPromises: Record<string, Promise<void | FBlob | null> | null>;getBlob(entityType: string, entityId: string): Promise<FBlob | null>;getNote(noteId: string, silentNotFoundError?: boolean): Promise<FNote | null>;diff --git a/apps/client/src/services/froca.ts b/apps/client/src/services/froca.tsindex c6ad3dc65b..131cec06f1 100644--- a/apps/client/src/services/froca.ts+++ b/apps/client/src/services/froca.ts@@ -36,7 +36,7 @@ class FrocaImpl implements Froca {branches!: Record<string, FBranch>;attributes!: Record<string, FAttribute>;attachments!: Record<string, FAttachment>;- blobPromises!: Record<string, Promise<FBlob> | null>;+ blobPromises!: Record<string, Promise<FBlob | null> | null>;constructor() {this.initializedPromise = this.loadInitialTree();diff --git a/apps/client/src/types.d.ts b/apps/client/src/types.d.tsindex b67be8f42a..7236973360 100644--- a/apps/client/src/types.d.ts+++ b/apps/client/src/types.d.ts@@ -21,7 +21,7 @@ interface CustomGlobals {getHeaders: typeof server.getHeaders;getReferenceLinkTitle: (href: string) => Promise<string>;getReferenceLinkTitleSync: (href: string) => string;- getActiveContextNote: () => FNote;+ getActiveContextNote: () => FNote | null;requireLibrary: typeof library_loader.requireLibrary;ESLINT: Library;appContext: AppContext;@@ -74,6 +74,9 @@ declare global {type AutoCompleteCallback = (values: AutoCompleteArg[]) => void;interface AutoCompleteArg {+ name?: string;+ value?: string;+ notePathTitle?: string;displayKey?: "name" | "value" | "notePathTitle";cache?: boolean;source?: (term: string, cb: AutoCompleteCallback) => void,@@ -83,7 +86,7 @@ declare global {}interface JQuery {- autocomplete: (action?: "close" | "open" | "destroy" | "val" | AutoCompleteConfig, args?: object[] | string) => JQuery<HTMLElement>;+ autocomplete: (action?: "close" | "open" | "destroy" | "val" | AutoCompleteConfig, args?: AutoCompleteArg[] | string) => JQuery<HTMLElement>;getSelectedNotePath(): string | undefined;getSelectedNoteId(): string | null;diff --git a/apps/client/src/widgets/buttons/attachments_actions.ts b/apps/client/src/widgets/buttons/attachments_actions.tsindex 8b904d6588..bb49b2178f 100644--- a/apps/client/src/widgets/buttons/attachments_actions.ts+++ b/apps/client/src/widgets/buttons/attachments_actions.ts@@ -10,7 +10,7 @@ import utils from "../../services/utils.js";import { Dropdown } from "bootstrap";import type FAttachment from "../../entities/fattachment.js";import type AttachmentDetailWidget from "../attachment_detail.js";-import { NoteRow } from "@triliumnext/commons";+import type { NoteRow } from "@triliumnext/commons";const TPL = /*html*/`<div class="dropdown attachment-actions">@@ -83,7 +83,7 @@ const TPL = /*html*/`// TODO: Deduplicateinterface AttachmentResponse {- note: NoteRow;+ note: NoteRow;}export default class AttachmentActionsWidget extends BasicWidget {diff --git a/apps/client/src/widgets/buttons/calendar.ts b/apps/client/src/widgets/buttons/calendar.tsindex 3bcba2558a..51e76dd614 100644--- a/apps/client/src/widgets/buttons/calendar.ts+++ b/apps/client/src/widgets/buttons/calendar.ts@@ -11,7 +11,7 @@ import dayjs, { Dayjs } from "dayjs";import utc from "dayjs/plugin/utc.js";import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";import "../../stylesheets/calendar.css";-import { AttributeRow } from "@triliumnext/commons";+import type { AttributeRow } from "@triliumnext/commons";dayjs.extend(utc);dayjs.extend(isSameOrAfter);diff --git a/tsconfig.base.json b/tsconfig.base.jsonindex 65e74f11c3..0d7434d9be 100644--- a/tsconfig.base.json+++ b/tsconfig.base.json@@ -11,9 +11,9 @@"noEmitOnError": true,"noFallthroughCasesInSwitch": true,"noImplicitAny": true,- "noImplicitOverride": true,- "noImplicitReturns": true,- "noUnusedLocals": true,+ "noImplicitOverride": false,+ "noImplicitReturns": false,+ "noUnusedLocals": false,"skipLibCheck": true,"strict": true,"target": "es2022",