From 0bd4f9a74ffe4933176122abe5eef5605b07c4cd Mon Sep 17 00:00:00 2001 From: Wolfie <32025746+Wolfkid200444@users.noreply.github.com> Date: Sat, 16 Mar 2024 11:40:59 -0400 Subject: [PATCH] tried my best to fix types --- src/plugins/holynotes/noteHandler.ts | 15 +++++++-------- src/plugins/holynotes/style.css | 4 ++++ src/plugins/holynotes/utils.ts | 5 ++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/holynotes/noteHandler.ts b/src/plugins/holynotes/noteHandler.ts index 538ae21b0..107ca136e 100644 --- a/src/plugins/holynotes/noteHandler.ts +++ b/src/plugins/holynotes/noteHandler.ts @@ -4,7 +4,6 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -import { DataStore } from "@api/index"; import { findByCode } from "@webpack"; import { ChannelStore, lodash, Toasts, UserStore } from "@webpack/common"; import { Channel, Message } from "discord-types/general"; @@ -49,7 +48,7 @@ export default new (class NoteHandler { for (const [key, value] of data) { notes[key] = value; } - return notes; + return notes as HolyNotes.Note[]; } public addNote = async (message: Message, notebook: string) => { @@ -71,7 +70,7 @@ export default new (class NoteHandler { const notes = this.getNotes(notebook); noteHandlerCache.set(notebook, lodash.omit(notes, noteId)); - saveCacheToDataStore(notebook, lodash.omit(notes, noteId)); + saveCacheToDataStore(notebook, lodash.omit(notes, noteId) as unknown as HolyNotes.Note[]); Toasts.show({ id: Toasts.genId(), @@ -89,8 +88,8 @@ export default new (class NoteHandler { noteHandlerCache.set(from, lodash.omit(origNotebook, note.id)); noteHandlerCache.set(to, newNoteBook); - saveCacheToDataStore(from, lodash.omit(origNotebook, note.id)); - saveCacheToDataStore(to, newNoteBook); + saveCacheToDataStore(from, lodash.omit(origNotebook, note.id) as unknown as HolyNotes.Note[]); + saveCacheToDataStore(to, newNoteBook as unknown as HolyNotes.Note[]); Toasts.show({ @@ -119,8 +118,8 @@ export default new (class NoteHandler { return; } - noteHandlerCache.set(notebookName, []); - saveCacheToDataStore(notebookName, [{}] as HolyNotes.Note[]); + noteHandlerCache.set(notebookName, [{}]); + saveCacheToDataStore(notebookName, [{} as HolyNotes.Note]); return Toasts.show({ id: Toasts.genId(), @@ -161,7 +160,7 @@ export default new (class NoteHandler { for (const notebook in notebooks) { noteHandlerCache.set(notebook, notebooks[notebook]); - saveCacheToDataStore(notebook, notebooks[notebook]); + saveCacheToDataStore(notebook, notebooks[notebook] as unknown as HolyNotes.Note[]); } Toasts.show({ diff --git a/src/plugins/holynotes/style.css b/src/plugins/holynotes/style.css index c3e10eae4..e80708f83 100644 --- a/src/plugins/holynotes/style.css +++ b/src/plugins/holynotes/style.css @@ -1,3 +1,6 @@ +/* stylelint-disable shorthand-property-no-redundant-values */ +/* stylelint-disable length-zero-no-unit */ + /* $modifier: var(--background-modifier-accent); */ @@ -115,6 +118,7 @@ $modifier: var(--background-modifier-accent); color: var(--interactive-normal); border-bottom-width: 2px; border-bottom-style: solid; + /* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */ border-bottom-color: transparent; } diff --git a/src/plugins/holynotes/utils.ts b/src/plugins/holynotes/utils.ts index ffea89786..8569a437a 100644 --- a/src/plugins/holynotes/utils.ts +++ b/src/plugins/holynotes/utils.ts @@ -25,9 +25,8 @@ export async function getFormatedEntries() { const notebooks: Record = {}; data.forEach(function (note) { - notebooks[note[0]] = note[1]; + notebooks[note[0].toString()] = note[1]; }); - return notebooks; } @@ -35,7 +34,7 @@ export async function DataStoreToCache() { const data = await DataStore.entries(HolyNoteStore); data.forEach(function (note) { - noteHandlerCache.set(note[0], note[1]); + noteHandlerCache.set(note[0].toString(), note[1]); }); }