A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
common: fix ts errors
ammarahm-ed9ef40c01ce83
diff --git a/packages/common/src/database.ts b/packages/common/src/database.tsindex 9fd2da3e4..610ad391d 100644--- a/packages/common/src/database.ts+++ b/packages/common/src/database.ts@@ -17,8 +17,6 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-// eslint-disable-next-line @typescript-eslint/ban-ts-comment-//@ts-ignoreimport Database from "@notesnook/core/dist/api/index";export const database = new Database();diff --git a/packages/common/src/utils/time.ts b/packages/common/src/utils/time.tsindex 979e7c1c3..8bc5b3b62 100644--- a/packages/common/src/utils/time.ts+++ b/packages/common/src/utils/time.ts@@ -17,24 +17,29 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { formatDate } from "@notesnook/core/dist/utils/date";+import {+ FormatDateOptions,+ TimeFormat,+ formatDate+} from "@notesnook/core/dist/utils/date";import { database } from "../database";import { formatReminderTime } from "@notesnook/core/dist/collections/reminders";+import { Reminder } from "@notesnook/core/dist/types";export function getFormattedDate(date: string | number | Date,- type: "time" | "date-time" | "date" = "date-time"+ type: FormatDateOptions["type"]) {return formatDate(date, {dateFormat: database.settings?.getDateFormat() as string,timeFormat: database.settings?.getTimeFormat() as string,type: type- });+ } as FormatDateOptions);}-export function getFormattedReminderTime(reminder: any, short = false) {+export function getFormattedReminderTime(reminder: Reminder, short = false) {return formatReminderTime(reminder, short, {dateFormat: database.settings?.getDateFormat() as string,- timeFormat: database.settings?.getTimeFormat() as string+ timeFormat: database.settings?.getTimeFormat() as TimeFormat});}diff --git a/packages/common/src/utils/total-notes.ts b/packages/common/src/utils/total-notes.tsindex 0ce040ef7..b4db3330f 100644--- a/packages/common/src/utils/total-notes.ts+++ b/packages/common/src/utils/total-notes.ts@@ -16,9 +16,10 @@ GNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/+import { Item } from "@notesnook/core/dist/types";import { database } from "../database";-export function getTotalNotes(item?: any) {+export function getTotalNotes(item?: Item) {if (!item || (item.type !== "notebook" && item.type !== "topic")) return 0;if (item.type === "topic") {return (diff --git a/packages/core/src/utils/date.ts b/packages/core/src/utils/date.tsindex e10cfd4c6..8f88981f8 100644--- a/packages/core/src/utils/date.ts+++ b/packages/core/src/utils/date.ts@@ -64,20 +64,20 @@ export function getTimeFormat(format: TimeFormat) {return format === "12-hour" ? "hh:mm A" : "HH:mm";}-type TimeOptions = {+export type TimeOptions = {type: "time";timeFormat: TimeFormat;};-type DateOptions = {+export type DateOptions = {type: "date";dateFormat: string;};-type DateTimeOptions = {+export type DateTimeOptions = {type: "date-time";dateFormat: string;timeFormat: TimeFormat;};-type FormatDateOptions = TimeOptions | DateOptions | DateTimeOptions;+export type FormatDateOptions = TimeOptions | DateOptions | DateTimeOptions;export function formatDate(date: string | number | Date | null | undefined,