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
mobile: fix all typescript errors
ammarahm-ed900de4f93f12
diff --git a/apps/mobile/app/common/database/index.js b/apps/mobile/app/common/database/index.jsindex 2ea388d47..fa13a586c 100644--- a/apps/mobile/app/common/database/index.js+++ b/apps/mobile/app/common/database/index.js@@ -53,9 +53,7 @@ export async function loadDatabase() {// DB = module.default;// }// db = new DB(Storage, Platform.OS === 'ios' ? EventSource : AndroidEventSource, filesystem);- // //@ts-ignore// if (DOMParser) {- // //@ts-ignore// await DOMParser.prepare();// }}diff --git a/apps/mobile/app/components/auth/two-factor.js b/apps/mobile/app/components/auth/two-factor.jsindex a73e5c04a..5fd5251e8 100644--- a/apps/mobile/app/components/auth/two-factor.js+++ b/apps/mobile/app/components/auth/two-factor.js@@ -194,7 +194,6 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {code.current = value;onNext();}}- //@ts-ignoreinputStyle={{fontSize: SIZE.lg,height: 60,@@ -208,8 +207,7 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {containerStyle={{height: 60,borderWidth: 0,- //@ts-ignore- width: null,+ width: undefined,minWidth: "50%"}}/>diff --git a/apps/mobile/app/components/delay-layout/default-placeholder.tsx b/apps/mobile/app/components/delay-layout/default-placeholder.tsxindex 075853388..7e0ce7623 100644--- a/apps/mobile/app/components/delay-layout/default-placeholder.tsx+++ b/apps/mobile/app/components/delay-layout/default-placeholder.tsx@@ -10,9 +10,11 @@ export const DefaultPlaceholder = ({ color }: { color: string }) => {const message = useMessageStore((state) => state.message);const annoucements = useMessageStore((state) => state.announcements);const hasAnnoucements = annoucements.length > 0;- //@ts-ignoreconst shadeColor = color- ? hexToRGBA(COLORS_NOTE[color?.toLowerCase()], 0.15)+ ? hexToRGBA(+ COLORS_NOTE[color?.toLowerCase() as keyof typeof COLORS_NOTE],+ 0.15+ ): colors.shade;return (diff --git a/apps/mobile/app/components/sheets/move-notes/movenote.tsx b/apps/mobile/app/components/sheets/move-notes/movenote.tsxindex fdbb2e573..7a502694b 100644--- a/apps/mobile/app/components/sheets/move-notes/movenote.tsx+++ b/apps/mobile/app/components/sheets/move-notes/movenote.tsx@@ -23,6 +23,15 @@ import { PressableButton } from "../../ui/pressable";import Seperator from "../../ui/seperator";import Heading from "../../ui/typography/heading";import Paragraph from "../../ui/typography/paragraph";++type CommonItemType = {+ id: string;+ title: string;+ headline?: string;+ type: string;+ notes?: string[];+};+export const MoveNotes = ({notebook,selectedTopic,@@ -74,7 +83,6 @@ export const MoveNotes = ({const addNewTopic = async (value: string) => {if (!value || value.trim().length === 0) {- //@ts-ignoreToastEvent.show({heading: "Topic title is required",type: "error",@@ -99,13 +107,13 @@ export const MoveNotes = ({return true;};- const renderItem = ({ item }: { item: TopicType | NoteType }) => {+ const renderItem = ({ item }: { item: CommonItemType }) => {return (<PressableButtontestID="listitem.select"onPress={() => {if (item.type == "topic") {- setTopic(topic || item);+ setTopic(topic || (item as TopicType));} else {select(item.id);}@@ -143,7 +151,7 @@ export const MoveNotes = ({}}color={colors.icon}>- {item.notes.length} Notes+ {item.notes?.length} Notes</Paragraph>) : null}diff --git a/apps/mobile/app/components/tip/index.tsx b/apps/mobile/app/components/tip/index.tsxindex 30dd7336f..eeb9543b6 100644--- a/apps/mobile/app/components/tip/index.tsx+++ b/apps/mobile/app/components/tip/index.tsx@@ -47,27 +47,23 @@ export const Tip = ({}}><Button- //@ts-ignoretitle="TIP"icon="information"fontSize={SIZE.xs}iconSize={SIZE.xs}- //@ts-ignorestyle={{- width: null,+ width: undefined,height: 22,paddingHorizontal: 4,alignSelf: "flex-start",borderRadius: 100,borderWidth: 1,- //@ts-ignore- borderColor: colors[color]+ borderColor: colors[color as keyof typeof colors] as string}}/>{neverShowAgain && (<Button- //@ts-ignoretitle="Never show again"type="grayBg"icon="close"@@ -77,9 +73,8 @@ export const Tip = ({MMKV.setItem("neverShowSheetTips", "true");eSendEvent(eCloseProgressDialog);}}- //@ts-ignorestyle={{- width: null,+ width: undefined,height: 25,paddingHorizontal: 4,alignSelf: "flex-start",@@ -116,7 +111,6 @@ export const Tip = ({{tip.button && (<Button- //@ts-ignoretitle={tip.button.title}type="accent"icon={tip.button.icon}diff --git a/apps/mobile/app/components/ui/animated-button.tsx/index.tsx b/apps/mobile/app/components/ui/animated-button.tsx/index.tsxindex 41a4186c3..1d5d4d6e4 100644--- a/apps/mobile/app/components/ui/animated-button.tsx/index.tsx+++ b/apps/mobile/app/components/ui/animated-button.tsx/index.tsx@@ -1,5 +1,5 @@import React from "react";-import { ActivityIndicator } from "react-native";+import { ActivityIndicator, ColorValue, ViewStyle } from "react-native";import Animated, {FadeIn,FadeOut,@@ -7,7 +7,7 @@ import Animated, {LightSpeedInLeft} from "react-native-reanimated";import Icon from "react-native-vector-icons/MaterialCommunityIcons";-import { useThemeStore } from "../../../stores/use-theme-store";+import { ColorKey, useThemeStore } from "../../../stores/use-theme-store";import { showTooltip, TOOLTIP_POSITIONS } from "../../../utils";import { BUTTON_TYPES } from "../../../utils/constants";import { SIZE } from "../../../utils/size";@@ -44,12 +44,11 @@ export const AnimatedButton = ({const textColor = buttonType?.text? buttonType.text- : //@ts-ignore- colors[+ : (colors[type === "accent"- ? BUTTON_TYPES[type](accentColor, accentText).text- : BUTTON_TYPES[type].text- ];+ ? (BUTTON_TYPES[type](accentColor, accentText).text as ColorKey)+ : (BUTTON_TYPES[type].text as ColorKey)+ ] as ColorValue);const Component = bold ? Heading : Paragraph;return (@@ -81,15 +80,14 @@ export const AnimatedButton = ({customAlpha={buttonType?.alpha}customStyle={{height: height,- width: width || null,+ width: width || undefined,paddingHorizontal: 12,borderRadius: 5,alignSelf: "center",justifyContent: "center",alignItems: "center",flexDirection: "row",- //@ts-ignore- ...style+ ...(style as ViewStyle)}}>{loading ? (@@ -113,7 +111,7 @@ export const AnimatedButton = ({<Componentlayout={Layout.springify()}animated={true}- color={textColor}+ color={textColor as string}size={fontSize}numberOfLines={1}style={[diff --git a/apps/mobile/app/components/ui/button/index.tsx b/apps/mobile/app/components/ui/button/index.tsxindex 94c2bb9e0..a7b5cacba 100644--- a/apps/mobile/app/components/ui/button/index.tsx+++ b/apps/mobile/app/components/ui/button/index.tsx@@ -1,7 +1,12 @@import React from "react";-import { ActivityIndicator, ColorValue, TextStyle } from "react-native";+import {+ ActivityIndicator,+ ColorValue,+ TextStyle,+ ViewStyle+} from "react-native";import Icon from "react-native-vector-icons/MaterialCommunityIcons";-import { useThemeStore } from "../../../stores/use-theme-store";+import { ColorKey, useThemeStore } from "../../../stores/use-theme-store";import { showTooltip, TOOLTIP_POSITIONS } from "../../../utils";import { BUTTON_TYPES } from "../../../utils/constants";import { SIZE } from "../../../utils/size";@@ -58,12 +63,11 @@ export const Button = ({const textColor = buttonType?.text? buttonType.text- : //@ts-ignore- colors[+ : (colors[type === "accent"- ? BUTTON_TYPES[type](accentColor, accentText).text- : BUTTON_TYPES[type].text- ];+ ? (BUTTON_TYPES[type](accentColor, accentText).text as ColorKey)+ : (BUTTON_TYPES[type].text as ColorKey)+ ] as ColorValue);const Component = bold ? Heading : Paragraph;return (@@ -90,15 +94,14 @@ export const Button = ({customAlpha={buttonType?.alpha}customStyle={{height: height,- width: width || null,+ width: width || undefined,paddingHorizontal: 12,borderRadius: 5,alignSelf: "center",justifyContent: "center",alignItems: "center",flexDirection: "row",- //@ts-ignore- ...style+ ...(style as ViewStyle)}}>{loading ? (@@ -116,7 +119,7 @@ export const Button = ({{!title ? null : (<Componentanimated={false}- color={textColor}+ color={textColor as string}size={fontSize}numberOfLines={1}style={[diff --git a/apps/mobile/app/components/ui/icon-button/index.tsx b/apps/mobile/app/components/ui/icon-button/index.tsxindex 6ea855a1b..3b143a594 100644--- a/apps/mobile/app/components/ui/icon-button/index.tsx+++ b/apps/mobile/app/components/ui/icon-button/index.tsx@@ -2,7 +2,7 @@ import React from "react";import { ColorValue, GestureResponderEvent, ViewStyle } from "react-native";import Animated, { Layout } from "react-native-reanimated";import Icon from "react-native-vector-icons/MaterialCommunityIcons";-import { useThemeStore } from "../../../stores/use-theme-store";+import { ColorKey, useThemeStore } from "../../../stores/use-theme-store";import { showTooltip, TOOLTIP_POSITIONS } from "../../../utils";import { hexToRGBA, RGB_Linear_Shade } from "../../../utils/color-scheme/utils";import { SIZE } from "../../../utils/size";@@ -76,8 +76,7 @@ export const IconButton = ({color={restProps.disabled? RGB_Linear_Shade(-0.05, hexToRGBA(colors.nav))- : //@ts-ignore- colors[color] || color+ : (colors[color as ColorKey] as ColorValue) || color}size={size}/>diff --git a/apps/mobile/app/components/ui/input/index.tsx b/apps/mobile/app/components/ui/input/index.tsxindex b079d02d0..ff021c876 100644--- a/apps/mobile/app/components/ui/input/index.tsx+++ b/apps/mobile/app/components/ui/input/index.tsx@@ -88,12 +88,8 @@ const Input = ({const [showError, setShowError] = useState(false);const [errorList, setErrorList] = useState({SHORT_PASS: true- // NO_ABC: true,- // NO_CAPS_ABC: true,- // NO_NUM: true,- // SPECIAL: true,});-+ type ErrorKey = keyof typeof errorList;const color = error? colors.red: focus@@ -208,8 +204,7 @@ const Input = ({height: height || 50,flexShrink: 1,fontFamily: "OpenSans-Regular",- //@ts-ignore- ...inputStyle+ ...(inputStyle as ViewStyle)};return (@@ -349,36 +344,28 @@ const Input = ({marginBottom: 5}}>- {- //@ts-ignore- Object.keys(errorList).filter((k) => errorList[k] === true)- .length !== 0- ? Object.keys(ERRORS_LIST).map((error) => (- <View- //@ts-ignore- key={ERRORS_LIST[error]}- style={{- flexDirection: "row",- alignItems: "center"- }}- >- <Icon- //@ts-ignore- name={errorList[error] ? "close" : "check"}- //@ts-ignore- color={errorList[error] ? "red" : "green"}- />+ {Object.keys(errorList).filter(+ (k) => errorList[k as ErrorKey] === true+ ).length !== 0+ ? Object.keys(ERRORS_LIST).map((error) => (+ <View+ key={ERRORS_LIST[error as ErrorKey]}+ style={{+ flexDirection: "row",+ alignItems: "center"+ }}+ >+ <Icon+ name={errorList[error as ErrorKey] ? "close" : "check"}+ color={errorList[error as ErrorKey] ? "red" : "green"}+ />- <Paragraph style={{ marginLeft: 5 }} size={SIZE.xs}>- {- //@ts-ignore- ERRORS_LIST[error]- }- </Paragraph>- </View>- ))- : null- }+ <Paragraph style={{ marginLeft: 5 }} size={SIZE.xs}>+ {ERRORS_LIST[error as ErrorKey]}+ </Paragraph>+ </View>+ ))+ : null}</View>)}</>diff --git a/apps/mobile/app/components/ui/pressable/index.tsx b/apps/mobile/app/components/ui/pressable/index.tsxindex 0d4224117..ec0b1a6bb 100644--- a/apps/mobile/app/components/ui/pressable/index.tsx+++ b/apps/mobile/app/components/ui/pressable/index.tsx@@ -8,7 +8,11 @@ import {ViewStyle} from "react-native";import Animated from "react-native-reanimated";-import { ThemeStore, useThemeStore } from "../../../stores/use-theme-store";+import {+ ColorKey,+ ThemeStore,+ useThemeStore+} from "../../../stores/use-theme-store";import { hexToRGBA, RGB_Linear_Shade } from "../../../utils/color-scheme/utils";import { BUTTON_TYPES } from "../../../utils/constants";import { br } from "../../../utils/size";@@ -48,19 +52,17 @@ export const PressableButton = ({const selectedColor =customSelectedColor ||- //@ts-ignorecolors[type === "accent"- ? BUTTON_TYPES[type](accentColor, accentText).selected- : BUTTON_TYPES[type].selected+ ? (BUTTON_TYPES[type](accentColor, accentText).selected as ColorKey)+ : (BUTTON_TYPES[type].selected as ColorKey)];const primaryColor =customColor ||- //@ts-ignorecolors[type === "accent"- ? BUTTON_TYPES[type](accentColor, accentText).primary- : BUTTON_TYPES[type].primary+ ? (BUTTON_TYPES[type](accentColor, accentText).primary as ColorKey)+ : (BUTTON_TYPES[type].primary as ColorKey)];const opacity = customOpacity? customOpacitydiff --git a/apps/mobile/app/components/walkthroughs/index.tsx b/apps/mobile/app/components/walkthroughs/index.tsxindex 4feafad19..6b5e335c6 100644--- a/apps/mobile/app/components/walkthroughs/index.tsx+++ b/apps/mobile/app/components/walkthroughs/index.tsx@@ -52,7 +52,6 @@ export const Walkthrough = ({) : null}{step.actionButton && (<Button- //@ts-ignorestyle={{height: 30,marginTop: 10@@ -69,7 +68,6 @@ export const Walkthrough = ({)}<Button- //@ts-ignorestyle={{borderRadius: 100,height: 40,@@ -94,7 +92,6 @@ export const Walkthrough = ({{canSkip ? (<Button- //@ts-ignorestyle={{height: 30,marginTop: 10@@ -142,11 +139,8 @@ Walkthrough.present = async (await Walkthrough.init();}if (walkthroughState[id]) return;- //@ts-ignoreWalkthrough.update(id);}-- //@ts-ignoreconst walkthrough = walkthroughs[id];if (!walkthrough) return;presentSheet({diff --git a/apps/mobile/app/hooks/use-rotator.ts b/apps/mobile/app/hooks/use-rotator.tsindex 7bd25639a..b062abea3 100644--- a/apps/mobile/app/hooks/use-rotator.ts+++ b/apps/mobile/app/hooks/use-rotator.ts@@ -6,13 +6,13 @@ import { useEffect, useRef, useState } from "react";*/function useRotator<T>(data: T[], interval = 3000): T | null {if (!Array.isArray(data)) return null;- //@ts-ignore+ //@ts-ignore Added sample() method to Array.prototype to get random value.const [current, setCurrent] = useState<T>(data.sample());const intervalRef = useRef<NodeJS.Timer>();useEffect(() => {intervalRef.current = setInterval(() => {- //@ts-ignore+ //@ts-ignore Added sample() method to Array.prototype to get random value.setCurrent(data.sample());}, interval);diff --git a/apps/mobile/app/hooks/use-sync-progress.ts b/apps/mobile/app/hooks/use-sync-progress.tsindex 6d555899e..be7a4d355 100644--- a/apps/mobile/app/hooks/use-sync-progress.ts+++ b/apps/mobile/app/hooks/use-sync-progress.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport { EVENTS } from "@streetwriters/notesnook-core/common";import { useCallback, useEffect, useState } from "react";import { db } from "../common/database";@@ -15,8 +14,6 @@ const useSyncProgress = () => {const onProgress = useCallback(({ type, current, total }: SyncProgressEventType) => {- //@ts-ignore-setProgress({ type, current, total });},[]diff --git a/apps/mobile/app/hooks/use-tooltip.ts b/apps/mobile/app/hooks/use-tooltip.tsindex dee5a7001..c72391859 100644--- a/apps/mobile/app/hooks/use-tooltip.ts+++ b/apps/mobile/app/hooks/use-tooltip.ts@@ -1,6 +1,5 @@import { RefObject, useEffect, useRef } from "react";import { Platform } from "react-native";-//@ts-ignoreimport RNTooltips from "react-native-tooltips";import { useThemeStore } from "../stores/use-theme-store";import {diff --git a/apps/mobile/app/hooks/use-vault-status.ts b/apps/mobile/app/hooks/use-vault-status.tsnew file mode 100644index 000000000..846aac553--- /dev/null+++ b/apps/mobile/app/hooks/use-vault-status.ts@@ -0,0 +1,48 @@+import React, { useCallback, useEffect } from "react";+import BiometicService from "../services/biometrics";+import { eSubscribeEvent, eUnSubscribeEvent } from "../services/event-manager";+import { db } from "../common/database";++const VaultStatusCache = {+ exists: false,+ biometryEnrolled: false,+ isBiometryAvailable: false+};++export type VaultStatusType = {+ exists: boolean;+ biometryEnrolled: boolean;+ isBiometryAvailable: boolean;+};++export const useVaultStatus = () => {+ const [vaultStatus, setVaultStatus] = React.useState(VaultStatusCache);++ const checkVaultStatus = useCallback(() => {+ db.vault?.exists().then(async (exists) => {+ const available = await BiometicService.isBiometryAvailable();+ const fingerprint = await BiometicService.hasInternetCredentials();+ if (+ VaultStatusCache.exists === exists &&+ VaultStatusCache.biometryEnrolled === fingerprint &&+ VaultStatusCache.isBiometryAvailable === available+ )+ return;+ setVaultStatus({+ exists: exists,+ biometryEnrolled: fingerprint,+ isBiometryAvailable: available ? true : false+ });+ });+ }, []);++ useEffect(() => {+ checkVaultStatus();+ eSubscribeEvent("vaultUpdated", () => checkVaultStatus());+ return () => {+ eUnSubscribeEvent("vaultUpdated", () => checkVaultStatus());+ };+ }, []);++ return vaultStatus;+};diff --git a/apps/mobile/app/screens/editor/index.tsx b/apps/mobile/app/screens/editor/index.tsxindex fe1c97878..7c0b5c2ec 100755--- a/apps/mobile/app/screens/editor/index.tsx+++ b/apps/mobile/app/screens/editor/index.tsx@@ -102,7 +102,6 @@ const Editor = React.memo(}, []);if (withController) {- //@ts-ignoreeditorController.current = editor;}@@ -165,17 +164,18 @@ const Editor = React.memo(export default Editor;-//@ts-ignorelet EditorOverlay: React.ElementType;-//@ts-ignorelet IconButton: React.ElementType;-//@ts-ignore-const AppSection = ({ editor, editorId }) => {+const AppSection = ({+ editor,+ editorId+}: {+ editor: useEditorType;+ editorId: string;+}) => {const [loaded, setLoaded] = useState(false);useEffect(() => {- //@ts-ignoreEditorOverlay = require("./loading.js").default;- //@ts-ignoreIconButton =require("../../components/ui/icon-button/index.tsx").IconButton;setLoaded(true);@@ -218,5 +218,3 @@ const ReadonlyButton = ({ editor }: { editor: useEditorType }) => {/>) : null;};--// test uri "http://192.168.10.8:3000/index.html"diff --git a/apps/mobile/app/screens/editor/tiptap/types.ts b/apps/mobile/app/screens/editor/tiptap/types.tsindex 8daf7a2c9..6add22d3c 100644--- a/apps/mobile/app/screens/editor/tiptap/types.ts+++ b/apps/mobile/app/screens/editor/tiptap/types.ts@@ -1,6 +1,7 @@import { useEditor } from "./use-editor";import type { ToolbarGroupDefinition } from "@streetwriters/editor/dist/toolbar/types";import { ThemeStore } from "../../../stores/use-theme-store";+import { NoteType } from "../../../utils/types";export type useEditorType = ReturnType<typeof useEditor>;export type EditorState = {@@ -73,7 +74,7 @@ export type SavePayload = {};export type AppState = {- note?: Note;+ note?: NoteType;editing: boolean;movedAway: boolean;timestamp: number;diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsindex e257f2b69..9bb0cdaa1 100644--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts@@ -1,6 +1,7 @@/* eslint-disable no-case-declarations *//* eslint-disable @typescript-eslint/no-var-requires */import { getDefaultPresets } from "@streetwriters/editor/dist/toolbar/tool-definitions";+import type { Attachment } from "@streetwriters/editor/dist/extensions/attachment/index";import { useCallback, useEffect, useRef } from "react";import {BackHandler,@@ -284,7 +285,7 @@ export const useEditorEvents = (case EventTypes.content:editor.saveContent({type: editorMessage.type,- content: editorMessage.value+ content: editorMessage.value as string});break;case EventTypes.selection:@@ -292,7 +293,7 @@ export const useEditorEvents = (case EventTypes.title:editor.saveContent({type: editorMessage.type,- title: editorMessage.value+ title: editorMessage.value as string});break;case EventTypes.newtag:@@ -303,7 +304,6 @@ export const useEditorEvents = (if (editorMessage.value) {if (!editor.note.current) return;db.notes- //@ts-ignore?.note(editor.note.current?.id).untag(editorMessage.value).then(async () => {@@ -325,7 +325,8 @@ export const useEditorEvents = (break;case EventTypes.download:console.log("download attachment request", editorMessage.value);- filesystem.downloadAttachment(editorMessage.value?.hash, true);+ const attachmentInfo = editorMessage.value as Attachment;+ filesystem.downloadAttachment(attachmentInfo?.hash, true);break;case EventTypes.pro:if (editor.state.current?.isFocused) {diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor.ts b/apps/mobile/app/screens/editor/tiptap/use-editor.tsindex eae5d4f02..fc4bc017f 100644--- a/apps/mobile/app/screens/editor/tiptap/use-editor.ts+++ b/apps/mobile/app/screens/editor/tiptap/use-editor.ts@@ -217,10 +217,8 @@ export const useEditor = (});}} else {- //@ts-ignore- noteData.contentId = note.contentId;- //@ts-ignore- await db.vault?.save(noteData);+ noteData.contentId = note?.contentId;+ await db.vault?.save(noteData as any);}console.log(id, sessionIdRef.current, currentSessionId);if (id && sessionIdRef.current === currentSessionId) {@@ -265,15 +263,19 @@ export const useEditor = (}, []);const loadNote = useCallback(- async (item: NoteType) => {+ async (+ item: Omit<NoteType, "type"> & {+ type: "note" | "new";+ forced?: boolean;+ }+ ) => {console.log("loading note", item.type, eOnLoadNote + editorId);state.current.currentlyEditing = true;const editorState = useEditorStore.getState();- //@ts-ignore todoif (item && item.type === "new") {currentNote.current && (await reset());- const nextSessionId = makeSessionId(item);+ const nextSessionId = makeSessionId(item as NoteType);setSessionId(nextSessionId);sessionIdRef.current = nextSessionId;sessionHistoryId.current = Date.now();@@ -281,18 +283,17 @@ export const useEditor = (await commands.focus();useEditorStore.getState().setReadonly(false);} else {- //@ts-ignore todoif (!item.forced && currentNote.current?.id === item.id) return;isDefaultEditor && editorState.setCurrentlyEditingNote(item.id);overlay(true, item);currentNote.current && (await reset(false));- await loadContent(item);- const nextSessionId = makeSessionId(item);+ await loadContent(item as NoteType);+ const nextSessionId = makeSessionId(item as NoteType);sessionHistoryId.current = Date.now();setSessionId(nextSessionId);sessionIdRef.current = nextSessionId;await commands.setSessionId(nextSessionId);- currentNote.current = item;+ currentNote.current = item as NoteType;await commands.setStatus(timeConverter(item.dateEdited), "Saved");await postMessage(EditorEvents.title, item.title);await postMessage(EditorEvents.html, currentContent.current?.data);@@ -310,7 +311,6 @@ export const useEditor = (if (!currentNote.current?.id) return;setTimeout(() => {if (!currentNote.current?.id) return;- //@ts-ignoreif (currentNote.current?.content?.isPreview) {db.content?.downloadMedia(currentNote.current?.id,@@ -393,7 +393,6 @@ export const useEditor = ();if (currentNote.current) {console.log("force reload note");- //@ts-ignoreloadNote({ ...currentNote.current, forced: true });} else {await commands.setPlaceholder(placeholderTip.current);@@ -421,7 +420,6 @@ export const useEditor = (setTimeout(() => {console.log("restoring app state here");if (appState.note) {- //@ts-ignoreloadNote(appState.note);}}, 1);diff --git a/apps/mobile/app/screens/editor/tiptap/utils.ts b/apps/mobile/app/screens/editor/tiptap/utils.tsindex 8e588d728..734e9b1ca 100644--- a/apps/mobile/app/screens/editor/tiptap/utils.ts+++ b/apps/mobile/app/screens/editor/tiptap/utils.ts@@ -1,4 +1,4 @@-import { createRef, RefObject } from "react";+import { createRef, MutableRefObject, RefObject } from "react";import { TextInput } from "react-native";import WebView from "react-native-webview";import {@@ -8,7 +8,8 @@ import {import { NoteType } from "../../../utils/types";import { EditorState, useEditorType } from "./types";export const textInput = createRef<TextInput>();-export const editorController = createRef<useEditorType>();+export const editorController =+ createRef<useEditorType>() as MutableRefObject<useEditorType>;export const defaultState: Partial<EditorState> = {movedAway: truediff --git a/apps/mobile/app/screens/notes/colored.tsx b/apps/mobile/app/screens/notes/colored.tsxindex 6b6809f36..b43707403 100644--- a/apps/mobile/app/screens/notes/colored.tsx+++ b/apps/mobile/app/screens/notes/colored.tsx@@ -34,22 +34,20 @@ ColoredNotes.get = (params: NotesScreenParams, grouped = true) => {ColoredNotes.navigate = (item: ColorType, canGoBack: boolean) => {if (!item) return;- //@ts-ignore TODOconst alias = getAlias({ item: item });Navigation.navigate<"ColoredNotes">({name: "ColoredNotes",- alias: toCamelCase(alias),+ alias: toCamelCase(alias as string),title: toCamelCase(item.title),id: item.id,type: "color",- //@ts-ignorecolor: item.title?.toLowerCase()},{item: item,canGoBack,- title: toCamelCase(alias)+ title: toCamelCase(alias as string)});};diff --git a/apps/mobile/app/screens/notes/common.ts b/apps/mobile/app/screens/notes/common.tsindex 7db7ba142..1a5cb2e72 100644--- a/apps/mobile/app/screens/notes/common.ts+++ b/apps/mobile/app/screens/notes/common.ts@@ -13,11 +13,10 @@ export function toCamelCase(title: string) {return title.slice(0, 1).toUpperCase() + title.slice(1);}-export function getAlias(params: NotesScreenParams) {+export function getAlias(params: Partial<NotesScreenParams>) {if (!params) return "";const { item } = params;- //@ts-ignore- return item.alias || item.title;+ return item?.alias || item?.title;}export function openMonographsWebpage() {@@ -60,7 +59,6 @@ export const setOnFirstSave = (editorState().onNoteCreated = null;return;}- //@ts-ignoreeditorState().onNoteCreated = (id) => onNoteCreated(id, data);};diff --git a/apps/mobile/app/screens/notes/index.tsx b/apps/mobile/app/screens/notes/index.tsxindex e619098e2..184215298 100644--- a/apps/mobile/app/screens/notes/index.tsx+++ b/apps/mobile/app/screens/notes/index.tsx@@ -17,7 +17,7 @@ import useNavigationStore, {RouteName} from "../../stores/use-navigation-store";import { useNoteStore } from "../../stores/use-notes-store";-import { NoteType } from "../../utils/types";+import { NoteType, TopicType } from "../../utils/types";import {getAlias,isSynced,@@ -101,7 +101,6 @@ const NotesPage = ({const syncWithNavigation = () => {const { item, title } = params.current;- //@ts-ignoreconst alias = getAlias(params.current);console.log(alias, title, "syncWithNavigation", params.current);useNavigationStore.getState().update(@@ -110,10 +109,9 @@ const NotesPage = ({title: alias || title,id: item?.id,type: "notes",- //@ts-ignore- notebookId: item?.notebookId,- alias: route.name === "ColoredNotes" ? toCamelCase(alias) : alias,- //@ts-ignore+ notebookId: (item as TopicType).notebookId,+ alias:+ route.name === "ColoredNotes" ? toCamelCase(alias as string) : alias,color:route.name === "ColoredNotes" ? item.title?.toLowerCase() : undefined},@@ -128,8 +126,7 @@ const NotesPage = ({type: getItemType(route.name),id: item.id,color: item.title,- //@ts-ignore- notebook: item.notebookId+ notebook: (item as TopicType).notebookId});};diff --git a/apps/mobile/app/screens/notes/monographs.tsx b/apps/mobile/app/screens/notes/monographs.tsxindex 19aba469e..d63d53820 100644--- a/apps/mobile/app/screens/notes/monographs.tsx+++ b/apps/mobile/app/screens/notes/monographs.tsx@@ -39,7 +39,6 @@ Monographs.navigate = (item: MonographType, canGoBack: boolean) => {type: "monograph"},{- //@ts-ignoreitem: { type: "monograph" },canGoBack,title: "Monographs"diff --git a/apps/mobile/app/screens/notes/tagged.tsx b/apps/mobile/app/screens/notes/tagged.tsxindex abb910070..708ce1065 100644--- a/apps/mobile/app/screens/notes/tagged.tsx+++ b/apps/mobile/app/screens/notes/tagged.tsx@@ -6,7 +6,7 @@ import Navigation, {NavigationProps,NotesScreenParams} from "../../services/navigation";-import { TagType } from "../../utils/types";+import { NoteType, TagType } from "../../utils/types";import { getAlias, openEditor } from "./common";export const TaggedNotes = ({navigation,@@ -26,7 +26,7 @@ export const TaggedNotes = ({};TaggedNotes.get = (params: NotesScreenParams, grouped = true) => {- const notes = db.notes?.tagged(params.item.id) || [];+ const notes = db.notes?.tagged((params.item as unknown as NoteType).id) || [];return grouped? groupArray(notes, db.settings?.getGroupOptions("notes")): notes;@@ -34,7 +34,6 @@ TaggedNotes.get = (params: NotesScreenParams, grouped = true) => {TaggedNotes.navigate = (item: TagType, canGoBack: boolean) => {if (!item) return;- //@ts-ignore TODOconst alias = getAlias({ item: item });Navigation.navigate<"TaggedNotes">({diff --git a/apps/mobile/app/screens/notes/topic-notes.tsx b/apps/mobile/app/screens/notes/topic-notes.tsxindex 24c8d7423..9fa2c447c 100644--- a/apps/mobile/app/screens/notes/topic-notes.tsx+++ b/apps/mobile/app/screens/notes/topic-notes.tsx@@ -9,7 +9,7 @@ import Navigation, {NotesScreenParams} from "../../services/navigation";import { eOpenAddTopicDialog } from "../../utils/events";-import { TopicType } from "../../utils/types";+import { NotebookType, TopicType } from "../../utils/types";import { openEditor } from "./common";const headerRightButtons = (params: NotesScreenParams) => [{@@ -28,7 +28,10 @@ const headerRightButtons = (params: NotesScreenParams) => [onPress: () => {const { item } = params;if (item?.type !== "topic") return;- MoveNotes.present(db.notebooks?.notebook(item.notebookId).data, item);+ MoveNotes.present(+ db.notebooks?.notebook(item.notebookId).data as NotebookType,+ item+ );}}];@@ -52,8 +55,7 @@ export const TopicNotes = ({};TopicNotes.get = (params: NotesScreenParams, grouped = true) => {- //@ts-ignore- const { id, notebookId } = params.item;+ const { id, notebookId } = params.item as TopicType;const notes = db.notebooks?.notebook(notebookId)?.topics.topic(id)?.all || [];return grouped? groupArray(notes, db.settings?.getGroupOptions("notes"))diff --git a/apps/mobile/app/screens/settings/2fa.tsx b/apps/mobile/app/screens/settings/2fa.tsxindex ecba4a36d..11eccc9c1 100644--- a/apps/mobile/app/screens/settings/2fa.tsx+++ b/apps/mobile/app/screens/settings/2fa.tsx@@ -285,8 +285,7 @@ export const MFASetup = ({loading={method?.id !== "sms" ? true : false}value={method?.id === "email"- ? //@ts-ignore- user.email+ ? user?.email: method?.id === "app"? authenticatorDetails?.sharedKey || "": undefined@@ -336,19 +335,17 @@ export const MFASetup = ({textAlign="center"keyboardType="numeric"onChangeText={(value) => (code.current = value)}- //@ts-ignoreinputStyle={{fontSize: SIZE.lg,height: 60,textAlign: "center",letterSpacing: 10,- width: null+ width: undefined}}containerStyle={{height: 60,borderWidth: 0,- //@ts-ignore- width: null+ width: undefined}}/><Seperator />@@ -397,7 +394,7 @@ export const MFARecoveryCodes = ({useEffect(() => {(async () => {try {- const codes = await db.mfa?.codes(true);+ const codes = await db.mfa?.codes();if (codes) setCodes(codes);setLoading(false);} catch (e) {diff --git a/apps/mobile/app/screens/settings/editor/configure-toolbar.tsx b/apps/mobile/app/screens/settings/editor/configure-toolbar.tsxindex b3b532718..08d11a118 100644--- a/apps/mobile/app/screens/settings/editor/configure-toolbar.tsx+++ b/apps/mobile/app/screens/settings/editor/configure-toolbar.tsx@@ -8,7 +8,7 @@ import Paragraph from "../../../components/ui/typography/paragraph";import { useThemeStore } from "../../../stores/use-theme-store";import { SIZE } from "../../../utils/size";import { Group } from "./group";-import { useDragState } from "./state";+import { DragState, useDragState } from "./state";export const ConfigureToolbar = () => {const data = useDragState((state) => state.data);const preset = useDragState((state) => state.preset);@@ -77,8 +77,9 @@ export const ConfigureToolbar = () => {marginRight: 10}}onPress={() => {- //@ts-ignore- useDragState.getState().setPreset(item.id);+ useDragState+ .getState()+ .setPreset(item.id as DragState["preset"]);}}fontSize={SIZE.sm - 1}key={item.name}diff --git a/apps/mobile/app/screens/settings/editor/group.tsx b/apps/mobile/app/screens/settings/editor/group.tsxindex 5e3342b3b..fd1ac8405 100644--- a/apps/mobile/app/screens/settings/editor/group.tsx+++ b/apps/mobile/app/screens/settings/editor/group.tsx@@ -13,6 +13,7 @@ import { DraggableItem, useDragState } from "./state";import ToolSheet from "./tool-sheet";import Icon from "react-native-vector-icons/MaterialCommunityIcons";+import { ToolId } from "@streetwriters/editor/dist/toolbar/tools";export const Group = ({item,index: groupIndex,@@ -80,8 +81,7 @@ export const Group = ({typeof dragged.parentIndex === "number"? (_data[dragged.parentIndex][dragged.groupIndex] as string[]): (_data[dragged.groupIndex] as string[]);- //@ts-ignore- _data[groupIndex].push(insertFrom.splice(dragged.index, 1)[0]);+ _data[groupIndex].push(insertFrom.splice(dragged.index, 1)[0] as ToolId);}setData(_data);diff --git a/apps/mobile/app/screens/settings/editor/state.ts b/apps/mobile/app/screens/settings/editor/state.tsindex e38f5e443..a18a6bd07 100644--- a/apps/mobile/app/screens/settings/editor/state.ts+++ b/apps/mobile/app/screens/settings/editor/state.ts@@ -1,6 +1,6 @@import type { ToolbarGroupDefinition } from "@streetwriters/editor/dist/toolbar/types";import create, { State } from "zustand";-import { persist } from "zustand/middleware";+import { persist, StateStorage } from "zustand/middleware";import { useNoteStore } from "../../../stores/use-notes-store";import { useSettingStore } from "../../../stores/use-setting-store";import { db } from "../../../common/database";@@ -93,7 +93,6 @@ export const useDragState = create<DragState>(toolbarConfig?.config);set({- //@ts-ignorepreset: preset,data:preset === "custom"@@ -108,8 +107,7 @@ export const useDragState = create<DragState>(}),{name: "drag-state-storage", // unique name- //@ts-ignore- getStorage: () => MMKV,+ getStorage: () => MMKV as StateStorage,onRehydrateStorage: () => {return () => {logger.info(diff --git a/apps/mobile/app/screens/settings/editor/tool-sheet.tsx b/apps/mobile/app/screens/settings/editor/tool-sheet.tsxindex 432739c5e..952a3db98 100644--- a/apps/mobile/app/screens/settings/editor/tool-sheet.tsx+++ b/apps/mobile/app/screens/settings/editor/tool-sheet.tsx@@ -28,10 +28,8 @@ export default function ToolSheet({const ungrouped = getUngroupedTools(data) as ToolId[];const renderTool = React.useCallback((item: ToolId) => {- //@ts-ignoreconst tool = findToolById(item);- //@ts-ignore- const iconSvgString = tool ? getToolIcon(tool.icon) : null;+ const iconSvgString = tool ? getToolIcon(tool.icon as ToolId) : null;return (<PressableButtonkey={item}@@ -39,8 +37,9 @@ export default function ToolSheet({onPress={() => {const _data = useDragState.getState().data.slice();if (group.groupIndex !== undefined) {- //@ts-ignore- _data[group.groupIndex][group.index].unshift(item);+ (_data[group.groupIndex][group.index] as ToolId[]).unshift(+ item as ToolId+ );} else {_data[group.index].unshift(item);}diff --git a/apps/mobile/app/screens/settings/editor/tool.tsx b/apps/mobile/app/screens/settings/editor/tool.tsxindex aef2ad85a..982c8fbd8 100644--- a/apps/mobile/app/screens/settings/editor/tool.tsx+++ b/apps/mobile/app/screens/settings/editor/tool.tsx@@ -15,6 +15,7 @@ import { findToolById, getToolIcon } from "./toolbar-definition";import ToolSheet from "./tool-sheet";import Icon from "react-native-vector-icons/MaterialCommunityIcons";+import { ToolId } from "@streetwriters/editor/dist/toolbar/tools";export const Tool = ({item,index,@@ -40,10 +41,10 @@ export const Tool = ({height: 0,width: 0});- //@ts-ignore- const tool = isSubgroup || item === "dummy" ? null : findToolById(item);- //@ts-ignore- const iconSvgString = isSubgroup || !tool ? null : getToolIcon(tool.icon);+ const tool =+ isSubgroup || item === "dummy" ? null : findToolById(item as ToolId);+ const iconSvgString =+ isSubgroup || !tool ? null : getToolIcon(tool.icon as ToolId);const buttons = isSubgroup? [@@ -89,12 +90,10 @@ export const Tool = ({);_data[groupIndex].splice(index, 1);} else {- //@ts-ignore- const index = _data[parentIndex][groupIndex].findIndex(- (tool: string) => tool === item- );- //@ts-ignore- _data[parentIndex][groupIndex].splice(index, 1);+ const index = (+ _data[parentIndex][groupIndex] as ToolId[]+ ).findIndex((tool: string) => tool === item);+ (_data[parentIndex][groupIndex] as ToolId[]).splice(index, 1);}console.log(_data[groupIndex]);setData(_data);@@ -115,13 +114,13 @@ export const Tool = ({if (hasSubGroup) {const subgroup = _data[groupIndex][_data[groupIndex].length - 1- ] as string[];- //@ts-ignore- subgroup.unshift(_item);+ ] as ToolId[];+ subgroup.unshift(_item as ToolId);} else {_data[groupIndex].push([]);- //@ts-ignore- _data[groupIndex][_data[groupIndex].length - 1].unshift(_item);+ (_data[groupIndex][_data[groupIndex].length - 1] as ToolId[]).unshift(+ _item as ToolId+ );}setData(_data);diff --git a/apps/mobile/app/screens/settings/editor/toolbar-definition.ts b/apps/mobile/app/screens/settings/editor/toolbar-definition.tsindex 16c1eb233..5b70819db 100644--- a/apps/mobile/app/screens/settings/editor/toolbar-definition.ts+++ b/apps/mobile/app/screens/settings/editor/toolbar-definition.ts@@ -21,12 +21,10 @@ export function findToolById(id: keyof typeof tools): {return tools[id];}-export function getToolIcon(id: keyof typeof tools) {- //@ts-ignore- const icon = Icons[id];+export function getToolIcon(id: ToolId) {+ const icon = Icons[id as keyof typeof Icons];const colors = useThemeStore.getState().colors;- //@ts-ignore- return id === "none"+ return (id as "none") === "none"? null: `<svg width="20" height="20" ><path d="${icon}" fill="${colors.icon}" />diff --git a/apps/mobile/app/screens/settings/group.tsx b/apps/mobile/app/screens/settings/group.tsxindex 08d938909..16987c9c1 100644--- a/apps/mobile/app/screens/settings/group.tsx+++ b/apps/mobile/app/screens/settings/group.tsx@@ -22,8 +22,7 @@ const Group = ({useNavigationStore.getState().update({name: "SettingsGroup",- //@ts-ignore- title: route.params.name+ title: route.params.name as string},true);diff --git a/apps/mobile/app/screens/settings/home.tsx b/apps/mobile/app/screens/settings/home.tsxindex 5f775ea2c..28d8ae73b 100644--- a/apps/mobile/app/screens/settings/home.tsx+++ b/apps/mobile/app/screens/settings/home.tsx@@ -58,7 +58,7 @@ const Home = ({<DelayLayout delay={300} type="settings"><View>{loading && (- //@ts-ignore+ //@ts-ignore // Migrate to typescript required.<BaseDialog animated={false} bounce={false} visible={true}><Viewstyle={{diff --git a/apps/mobile/app/screens/settings/index.tsx b/apps/mobile/app/screens/settings/index.tsxindex 3ef2875c0..2a0d111d6 100644--- a/apps/mobile/app/screens/settings/index.tsx+++ b/apps/mobile/app/screens/settings/index.tsx@@ -4,10 +4,10 @@ import useNavigationStore from "../../stores/use-navigation-store";import { useThemeStore } from "../../stores/use-theme-store";import Group from "./group";import Home from "./home";-const SettingsStack = createNativeStackNavigator();+import { RouteParams } from "./types";+const SettingsStack = createNativeStackNavigator<RouteParams>();const screenListeners = {- //@ts-ignore- beforeRemove: (e) => {+ beforeRemove: (e: any) => {if (e.target?.startsWith("SettingsGroup")) {useNavigationStore.getState().update({ name: "Settings" }, false);}diff --git a/apps/mobile/app/screens/settings/section-item.tsx b/apps/mobile/app/screens/settings/section-item.tsxindex 5622075f3..e04a690a6 100644--- a/apps/mobile/app/screens/settings/section-item.tsx+++ b/apps/mobile/app/screens/settings/section-item.tsx@@ -31,10 +31,8 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {}if (!item.property) return;SettingsService.set({- //@ts-ignore[item.property]: !settings[item.property]});- //@ts-ignoreitem.onChange?.(!settings[item.property]);};@@ -142,7 +140,6 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {{item.type === "switch" && item.property && (<ToggleSwitch- //@ts-ignoreisOn={item.getter? item.getter(item.property || current)diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsxindex d1fa2b526..13e704742 100644--- a/apps/mobile/app/screens/settings/settings-data.tsx+++ b/apps/mobile/app/screens/settings/settings-data.tsx@@ -10,7 +10,7 @@ import { presentDialog } from "../../components/dialog/functions";import { Issue } from "../../components/sheets/github/issue";import { Progress } from "../../components/sheets/progress";import { Update } from "../../components/sheets/update";-import { useVaultStatus } from "../../hooks/use-vault-status";+import { useVaultStatus, VaultStatusType } from "../../hooks/use-vault-status";import BackupService from "../../services/backup";import BiometicService from "../../services/biometrics";import {@@ -81,7 +81,10 @@ export const settingsGroups: SettingSection[] = [description: (current) => {const user = current as User;const subscriptionDaysLeft =- user && getTimeLeft(parseInt(user.subscription?.expiry));+ user &&+ getTimeLeft(+ parseInt(user.subscription?.expiry as unknown as string)+ );const expiryDate = dayjs(user?.subscription?.expiry).format("MMMM D, YYYY");@@ -157,7 +160,7 @@ export const settingsGroups: SettingSection[] = [},useHook: () => useUserStore((state) => state.user),hidden: (user) => {- return !!user?.mfa?.isEnabled;+ return !!(user as User)?.mfa?.isEnabled;},description: "Increased security for your account"},@@ -166,7 +169,10 @@ export const settingsGroups: SettingSection[] = [name: "Add fallback 2FA method",useHook: () => useUserStore((state) => state.user),hidden: (user) => {- return !!user?.mfa?.secondaryMethod || !user?.mfa?.isEnabled;+ return (+ !!(user as User)?.mfa?.secondaryMethod ||+ !(user as User)?.mfa?.isEnabled+ );},modifer: () => {verifyUser("global", async () => {@@ -181,7 +187,10 @@ export const settingsGroups: SettingSection[] = [name: "Reconfigure fallback 2FA method",useHook: () => useUserStore((state) => state.user),hidden: (user) => {- return !user?.mfa?.secondaryMethod || !user?.mfa?.isEnabled;+ return (+ !(user as User)?.mfa?.secondaryMethod ||+ !(user as User)?.mfa?.isEnabled+ );},modifer: () => {verifyUser("global", async () => {@@ -201,7 +210,7 @@ export const settingsGroups: SettingSection[] = [},useHook: () => useUserStore((state) => state.user),hidden: (user) => {- return !user?.mfa?.isEnabled;+ return !(user as User)?.mfa?.isEnabled;},description:"View and save recovery codes for to recover your account"@@ -219,7 +228,7 @@ export const settingsGroups: SettingSection[] = [useHook: () => useUserStore((state) => state.user),hidden: (user) => {- return !user?.mfa?.isEnabled;+ return !(user as User)?.mfa?.isEnabled;},description: "Decreased security for your account"}@@ -480,7 +489,7 @@ export const settingsGroups: SettingSection[] = [description: "Set a password to create vault and lock notes.",icon: "key",useHook: useVaultStatus,- hidden: (current) => current?.exists,+ hidden: (current) => (current as VaultStatusType)?.exists,modifer: () => {PremiumService.verify(() => {openVault({@@ -497,7 +506,7 @@ export const settingsGroups: SettingSection[] = [useHook: useVaultStatus,name: "Change vault password",description: "Setup a new password for your vault.",- hidden: (current) => !current?.exists,+ hidden: (current) => !(current as VaultStatusType)?.exists,modifer: () =>openVault({item: {},@@ -512,7 +521,7 @@ export const settingsGroups: SettingSection[] = [useHook: useVaultStatus,name: "Clear vault",description: "Unlock all locked notes",- hidden: (current) => !current?.exists,+ hidden: (current) => !(current as VaultStatusType)?.exists,modifer: () => {openVault({item: {},@@ -529,7 +538,7 @@ export const settingsGroups: SettingSection[] = [name: "Delete vault",description: "Delete vault (and optionally remove all notes).",useHook: useVaultStatus,- hidden: (current) => !current?.exists,+ hidden: (current) => !(current as VaultStatusType)?.exists,modifer: () => {openVault({item: {},@@ -547,19 +556,22 @@ export const settingsGroups: SettingSection[] = [icon: "fingerprint",useHook: useVaultStatus,description: "Access notes in vault using biometrics",- hidden: (current) =>- !current?.exists || !current?.isBiometryAvailable,- getter: (current) => current?.biometryEnrolled,+ hidden: (current) => {+ const _current = current as VaultStatusType;+ return !_current?.exists || !_current?.isBiometryAvailable;+ },+ getter: (current) => (current as VaultStatusType)?.biometryEnrolled,modifer: (current) => {+ const _current = current as VaultStatusType;openVault({item: {},- fingerprintAccess: !current.biometryEnrolled,- revokeFingerprintAccess: current.biometryEnrolled,+ fingerprintAccess: !_current.biometryEnrolled,+ revokeFingerprintAccess: _current.biometryEnrolled,novault: true,- title: current.biometryEnrolled+ title: _current.biometryEnrolled? "Revoke biometric unlocking": "Enable biometery unlock",- description: current.biometryEnrolled+ description: _current.biometryEnrolled? "Disable biometric unlocking for notes in vault": "Enable biometric unlocking for notes in vault"});@@ -802,6 +814,7 @@ export const settingsGroups: SettingSection[] = [icon: "bug",modifer: () => {presentSheet({+ //@ts-ignore Migrate to TScomponent: <Issue />});},@@ -967,7 +980,7 @@ export const settingsGroups: SettingSection[] = [description: "Check for new version of Notesnook",modifer: async () => {presentSheet({- //@ts-ignore+ //@ts-ignore // Migrate to tscomponent: (ref) => <Update fwdRef={ref} />});}diff --git a/apps/mobile/app/services/biometrics.ts b/apps/mobile/app/services/biometrics.tsindex 8206a1057..95adb4380 100644--- a/apps/mobile/app/services/biometrics.ts+++ b/apps/mobile/app/services/biometrics.ts@@ -1,9 +1,11 @@import { Platform } from "react-native";-import FingerprintScanner from "react-native-fingerprint-scanner";+import FingerprintScanner, {+ AuthenticateIOS+} from "react-native-fingerprint-scanner";import * as Keychain from "react-native-keychain";-import { useSettingStore } from "../stores/use-setting-store";import { MMKV } from "../common/database/mmkv";import Storage from "../common/database/storage";+import { useSettingStore } from "../stores/use-setting-store";import { ShowToastEvent, ToastEvent } from "./event-manager";const KeychainConfig = Platform.select({@@ -62,23 +64,22 @@ async function getCredentials(title?: string, description?: string) {deviceCredentialAllowed: true}});- //@ts-ignore- await FingerprintScanner.authenticate(options);+ await FingerprintScanner.authenticate(options as AuthenticateIOS);setTimeout(() => {useSettingStore.getState().setRequestBiometrics(false);}, 1000);FingerprintScanner.release();return await Keychain.getInternetCredentials("nn_vault");- } catch (e) {+ } catch (error) {+ const e = error as { name: string };useSettingStore.getState().setRequestBiometrics(false);FingerprintScanner.release();let message: ShowToastEvent = {heading: "Authentication with biometrics failed.",- message: "Tap \"Biometric Unlock\" to try again.",+ message: 'Tap "Biometric Unlock" to try again.',type: "error",context: "local"};- //@ts-ignoreif (e.name === "DeviceLocked") {message = {heading: "Biometrics authentication failed.",@@ -86,11 +87,10 @@ async function getCredentials(title?: string, description?: string) {type: "error",context: "local"};- //@ts-ignore} else if (e.name === "UserFallback") {message = {heading: "Authentication cancelled by user.",- message: "Tap \"Biometric Unlock\" to try again.",+ message: 'Tap "Biometric Unlock" to try again.',type: "error",context: "local"};@@ -104,7 +104,6 @@ async function getCredentials(title?: string, description?: string) {async function validateUser(title: string, description?: string) {try {await FingerprintScanner.authenticate(- //@ts-ignorePlatform.select({ios: {fallbackEnabled: true,@@ -115,13 +114,13 @@ async function validateUser(title: string, description?: string) {description: description,deviceCredentialAllowed: true}- })+ }) as AuthenticateIOS);FingerprintScanner.release();return true;- } catch (e) {+ } catch (error) {+ const e = error as { name: string };FingerprintScanner.release();- //@ts-ignoreif (e.name === "DeviceLocked") {ToastEvent.show({heading: "Biometrics authentication failed.",diff --git a/apps/mobile/app/services/navigation.ts b/apps/mobile/app/services/navigation.tsindex b6e66ef9d..98fb53320 100755--- a/apps/mobile/app/services/navigation.ts+++ b/apps/mobile/app/services/navigation.ts@@ -3,8 +3,9 @@ import { NativeStackScreenProps } from "@react-navigation/native-stack";import { useFavoriteStore } from "../stores/use-favorite-store";import useNavigationStore, {CurrentScreen,- Route,- RouteName+ GenericRouteParam,+ RouteName,+ RouteParams} from "../stores/use-navigation-store";import { useNotebookStore } from "../stores/use-notebook-store";import { useNoteStore } from "../stores/use-notes-store";@@ -12,14 +13,13 @@ import { useTagStore } from "../stores/use-tag-store";import { useTrashStore } from "../stores/use-trash-store";import { eOnNewTopicAdded } from "../utils/events";import { rootNavigatorRef, tabBarRef } from "../utils/global-refs";-import { ColorType, NotebookType, TagType, TopicType } from "../utils/types";import { eSendEvent } from "./event-manager";import SettingsService from "./settings";/*** Routes that should be updated on focus*/-let routesUpdateQueue: Route[] = [];+let routesUpdateQueue: RouteName[] = [];const routeNames = {Notes: "Notes",@@ -43,46 +43,6 @@ const routeNames = {Signup: "Signup"};-type GenericRouteParam = { [name: string]: unknown };--export type NotebookScreenParams = {- item: NotebookType;- title: string;- canGoBack: boolean;-};--export type NotesScreenParams = {- item: TopicType | TagType | ColorType;- title: string;- canGoBack: boolean;-};--export type AppLockRouteParams = {- welcome: boolean;-};--export type AuthParams = {- mode: number;-};--export type RouteParams = {- Notes: GenericRouteParam;- Notebooks: GenericRouteParam;- Notebook: NotebookScreenParams;- NotesPage: NotesScreenParams;- Tags: GenericRouteParam;- Favorites: GenericRouteParam;- Trash: GenericRouteParam;- Search: GenericRouteParam;- Settings: GenericRouteParam;- TaggedNotes: NotesScreenParams;- ColoredNotes: NotesScreenParams;- TopicNotes: NotesScreenParams;- Monographs: NotesScreenParams;- AppLock: AppLockRouteParams;- Auth: AuthParams;-};-export type NavigationProps<T extends RouteName> = NativeStackScreenProps<RouteParams,T@@ -107,7 +67,7 @@ const routeUpdateFunctions: {Monographs: (params) => eSendEvent("Monographs", params)};-function clearRouteFromQueue(routeName: Route) {+function clearRouteFromQueue(routeName: RouteName) {if (routesUpdateQueue.indexOf(routeName) !== -1) {routesUpdateQueue = [...new Set(routesUpdateQueue)];routesUpdateQueue.splice(routesUpdateQueue.indexOf(routeName), 1);@@ -117,7 +77,7 @@ function clearRouteFromQueue(routeName: Route) {/*** Check if a route needs update*/-function routeNeedsUpdate(routeName: Route, callback: () => void) {+function routeNeedsUpdate(routeName: RouteName, callback: () => void) {console.log("routeNeedsUpdate",routesUpdateQueue,@@ -130,7 +90,7 @@ function routeNeedsUpdate(routeName: Route, callback: () => void) {}}-function queueRoutesForUpdate(...routes: Route[]) {+function queueRoutesForUpdate(...routes: RouteName[]) {console.log("updating routes", routes);const currentScreen = useNavigationStore.getState().currentScreen;// const routeHistory = rootNavigatorRef.current?.getRootState()?.routes || [@@ -139,7 +99,6 @@ function queueRoutesForUpdate(...routes: Route[]) {// filter out routes that are not rendered to prevent unnecessary updates// routes = routes.filter(- // //@ts-ignore// routeName => routeHistory?.findIndex(route => route.key?.startsWith(routeName)) > -1// );@@ -165,8 +124,8 @@ function navigate<T extends RouteName>(if (screen.name === "Notebook") routeUpdateFunctions["Notebook"](params);if (screen.name.endsWith("Notes") && screen.name !== "Notes")routeUpdateFunctions[screen.name](params);- // @ts-ignore- rootNavigatorRef.current?.navigate(screen.name, params);+ //@ts-ignore Not sure how to fix this for now ignore it.+ rootNavigatorRef.current?.navigate<RouteName>(screen.name, params);}function goBack() {@@ -192,7 +151,7 @@ function replace<T extends RouteName>(function popToTop() {rootNavigatorRef.current?.dispatch(StackActions.popToTop());useNavigationStore.getState().update({- name: SettingsService.get().homepage || "Notes"+ name: (SettingsService.get().homepage as RouteName) || "Notes"});}diff --git a/apps/mobile/app/services/notifications.ts b/apps/mobile/app/services/notifications.tsindex 7729fe932..d498ab464 100644--- a/apps/mobile/app/services/notifications.ts+++ b/apps/mobile/app/services/notifications.ts@@ -1,7 +1,8 @@import { Platform } from "react-native";import PushNotification, {Importance,- PushNotificationDeliveredObject+ PushNotificationDeliveredObject,+ PushNotificationObject} from "react-native-push-notification";import { db } from "../common/database";import { MMKV } from "../common/database/mmkv";@@ -39,20 +40,22 @@ function init() {editorState().movedAway = false;MMKV.removeItem("appState");if (useNoteStore?.getState()?.loading === false) {- //@ts-ignoreawait db.init();- //@ts-ignore- await db.notes.init();- //@ts-ignore- loadNote(notification.tag, false);+ await db.notes?.init();+ loadNote(+ (notification as unknown as PushNotificationDeliveredObject).tag,+ false+ );return;}const unsub = useNoteStore.subscribe((loading) => {if (loading === false) {- //@ts-ignore- loadNote(notification.tag, true);+ loadNote(+ (notification as unknown as PushNotificationDeliveredObject).tag,+ true+ );}unsub();},@@ -63,8 +66,10 @@ function init() {console.log("ACTION: ", notification.action);switch (notification.action) {case "UNPIN":- //@ts-ignore- remove(notification.tag, notification.id);+ remove(+ (notification as unknown as PushNotificationDeliveredObject).tag,+ notification.id+ );break;case "Hide":unpinQuickNote();@@ -73,7 +78,7 @@ function init() {console.log("texto", notification);present({title: "Quick note",- message: "Tap on \"Take note\" to add a note.",+ message: 'Tap on "Take note" to add a note.',ongoing: true,actions: ["ReplyInput", "Hide"],tag: "notesnook_note_input",@@ -85,21 +90,23 @@ function init() {await db.notes?.add({content: {type: "tiptap",- //@ts-ignore- data: `<p>${notification.reply_text} </p>`+ data: `<p>${+ (+ notification as unknown as PushNotificationDeliveredObject & {+ reply_text: string;+ }+ ).reply_text+ } </p>`}});- //@ts-ignore- await db.notes.init();+ await db.notes?.init();useNoteStore.getState().setNotes();- //@ts-ignore/////break;}},popInitialNotification: true,- //@ts-ignore- requestPermissions: Platform.OS === "ios"+ requestPermissions: false});PushNotification.createChannel(@@ -134,7 +141,7 @@ function pinQuickNote(launch: boolean) {console.log("showing");present({title: "Quick note",- message: "Tap on \"Take note\" to add a note.",+ message: 'Tap on "Take note" to add a note.',ongoing: true,actions: ["ReplyInput", "Hide"],tag: "notesnook_note_input",@@ -188,9 +195,10 @@ function present({invokeApp: false,autoCancel: false,smallIcon: "ic_stat_name",- //@ts-ignorereply_placeholder_text,reply_button_text+ } as PushNotificationObject & {+ reply_placeholder_text: string;});}diff --git a/apps/mobile/app/services/settings.ts b/apps/mobile/app/services/settings.tsindex 937087508..23a60a80f 100644--- a/apps/mobile/app/services/settings.ts+++ b/apps/mobile/app/services/settings.ts@@ -9,6 +9,7 @@ import { scale, updateSize } from "../utils/size";import Notifications from "./notifications";import Orientation from "react-native-orientation";import { DDS } from "./device-detection";+import { ThemeStore } from "../stores/use-theme-store";function migrate(settings: SettingStore["settings"]) {if (settings.migrated) return true;@@ -32,8 +33,9 @@ function migrate(settings: SettingStore["settings"]) {settings.rateApp = false;} else {askForRating = JSON.parse(askForRating);- //@ts-ignore- settings.rateApp = askForRating.timestamp;+ settings.rateApp = (+ askForRating as unknown as { timestamp: number }+ ).timestamp;}console.log("migrated askForRating", askForRating);MMKV.removeItem("askForRating");@@ -42,8 +44,9 @@ function migrate(settings: SettingStore["settings"]) {let askForBackup = MMKV.getString("askForBackup");if (askForBackup) {askForBackup = JSON.parse(askForBackup);- //@ts-ignore- settings.rateApp = askForBackup.timestamp;+ settings.rateApp = (+ askForBackup as unknown as { timestamp: number }+ ).timestamp;MMKV.removeItem("askForBackup");console.log("migrated askForBackup", askForBackup);}@@ -73,13 +76,10 @@ function migrate(settings: SettingStore["settings"]) {let theme = MMKV.getString("theme");if (theme) {theme = JSON.parse(theme);- //@ts-ignore- if (theme.night) settings.theme.dark = true;+ if ((theme as unknown as ThemeStore["colors"]).night)+ settings.theme.dark = true;MMKV.removeItem("theme");}-- console.log("migrated theme", theme);-const backupStorageDir = MMKV.getString("backupStorageDir");if (backupStorageDir)settings.backupDirectoryAndroid = JSON.parse(backupStorageDir);@@ -160,6 +160,7 @@ function toggle(id: keyof SettingStore["settings"]) {};//@ts-ignoresettings[id] = !settings[id];+useSettingStore.getState().setSettings(settings);MMKV.setString("appSettings", JSON.stringify(settings));}@@ -179,16 +180,12 @@ function onFirstLaunch() {}function checkOrientation() {- //@ts-ignore- Orientation.getOrientation((e, r) => {- DDS.checkSmallTab(r);- //@ts-ignore- useSettingStore- .getState()- .setDimensions({- width: DDS.width as number,- height: DDS.height as number- });+ Orientation.getOrientation((e: Error, orientation: string) => {+ DDS.checkSmallTab(orientation);+ useSettingStore.getState().setDimensions({+ width: DDS.width as number,+ height: DDS.height as number+ });useSettingStore.getState().setDeviceMode(diff --git a/apps/mobile/app/services/tip-manager.ts b/apps/mobile/app/services/tip-manager.tsindex 51053bed3..b00d894be 100644--- a/apps/mobile/app/services/tip-manager.ts+++ b/apps/mobile/app/services/tip-manager.ts@@ -1,7 +1,12 @@import { useEffect, useRef, useState } from "react";import { MMKV } from "../common/database/mmkv";-//@ts-ignore+declare global {+ interface Array<T> {+ sample(): T;+ }+}+Array.prototype.sample = function () {return this[Math.floor(Math.random() * this.length)];};@@ -51,7 +56,6 @@ export class TipManager {if (tipStateJson) {tipState = JSON.parse(tipStateJson);} else {- //@ts-ignoretipState = {};}@@ -59,42 +63,33 @@ export class TipManager {if (popStateJson) {popState = JSON.parse(popStateJson);} else {- //@ts-ignorepopState = {};}}static tip(context: Context) {if (destructiveContexts.indexOf(context) > -1) {- //@ts-ignoreif (tipState[context]) return;- //@ts-ignoretipState[context] = true;MMKV.setString("tipState", JSON.stringify(tipState));}const tipsForCtx = tips.filter((tip) => tip.contexts.indexOf(context) > -1);-- //@ts-ignorereturn tipsForCtx.sample();}static popup(id: string) {const pop = popups.find((p) => p.id === id);- //@ts-ignore- // if (popState[id]) return null;return pop;}static markPopupUsed(id: string) {- //@ts-ignorepopState[id] = true;MMKV.setString("popupState", JSON.stringify(popState));}static placeholderTip() {- //@ts-ignorereturn placeholderTips.sample();}}diff --git a/apps/mobile/app/stores/index.ts b/apps/mobile/app/stores/index.tsindex d872a3adb..5e83d3e45 100644--- a/apps/mobile/app/stores/index.ts+++ b/apps/mobile/app/stores/index.ts@@ -1,18 +1,18 @@-//@ts-ignoreimport { db } from "../common/database";-import { useNoteStore } from "./use-notes-store";+import Navigation from "../services/navigation";import { useFavoriteStore } from "./use-favorite-store";import { useMenuStore } from "./use-menu-store";+import { RouteName } from "./use-navigation-store";import { useNotebookStore } from "./use-notebook-store";+import { useNoteStore } from "./use-notes-store";import { useTagStore } from "./use-tag-store";import { useTrashStore } from "./use-trash-store";-import Navigation from "../services/navigation";export function initAfterSync() {useMenuStore.getState().setColorNotes();useMenuStore.getState().setMenuPins();Navigation.queueRoutesForUpdate(- ...Object.keys(Navigation.routeUpdateFunctions)+ ...(Object.keys(Navigation.routeUpdateFunctions) as unknown as RouteName[]));}diff --git a/apps/mobile/app/stores/use-attachment-store.ts b/apps/mobile/app/stores/use-attachment-store.tsindex 6a92cf77a..87da1cf50 100644--- a/apps/mobile/app/stores/use-attachment-store.ts+++ b/apps/mobile/app/stores/use-attachment-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport create from "zustand";import { editorController } from "../screens/editor/tiptap/utils";diff --git a/apps/mobile/app/stores/use-editor-store.ts b/apps/mobile/app/stores/use-editor-store.tsindex 96eb99506..5a9ca58f3 100644--- a/apps/mobile/app/stores/use-editor-store.ts+++ b/apps/mobile/app/stores/use-editor-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport create, { State } from "zustand";import { eSubscribeEvent, eUnSubscribeEvent } from "../services/event-manager";diff --git a/apps/mobile/app/stores/use-favorite-store.ts b/apps/mobile/app/stores/use-favorite-store.tsindex ef385bf3b..d9271aa52 100644--- a/apps/mobile/app/stores/use-favorite-store.ts+++ b/apps/mobile/app/stores/use-favorite-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport { groupArray } from "@streetwriters/notesnook-core/utils/grouping";import create, { State } from "zustand";import { db } from "../common/database";diff --git a/apps/mobile/app/stores/use-menu-store.ts b/apps/mobile/app/stores/use-menu-store.tsindex 48af62cec..c146ae198 100644--- a/apps/mobile/app/stores/use-menu-store.ts+++ b/apps/mobile/app/stores/use-menu-store.ts@@ -1,10 +1,10 @@-//@ts-ignoreimport create, { State } from "zustand";import { db } from "../common/database";+import { ColorType } from "../utils/types";export interface MenuStore extends State {- menuPins: object[];- colorNotes: object[];+ menuPins: [];+ colorNotes: ColorType[];setMenuPins: () => void;setColorNotes: () => void;clearAll: () => void;@@ -26,7 +26,7 @@ export const useMenuStore = create<MenuStore>((set) => ({}, 1000);}},- //@ts-ignore- setColorNotes: () => set({ colorNotes: db.colors?.all || [] }),+ setColorNotes: () =>+ set({ colorNotes: (db.colors?.all as ColorType[]) || [] }),clearAll: () => set({ menuPins: [], colorNotes: [] })}));diff --git a/apps/mobile/app/stores/use-message-store.ts b/apps/mobile/app/stores/use-message-store.tsindex 5c3d6e9ea..291348eb9 100644--- a/apps/mobile/app/stores/use-message-store.ts+++ b/apps/mobile/app/stores/use-message-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport { Platform } from "react-native";import create, { State } from "zustand";import { APP_VERSION } from "../version";diff --git a/apps/mobile/app/stores/use-navigation-store.ts b/apps/mobile/app/stores/use-navigation-store.tsindex bb29fa6d1..2091ba2e5 100644--- a/apps/mobile/app/stores/use-navigation-store.ts+++ b/apps/mobile/app/stores/use-navigation-store.ts@@ -1,30 +1,65 @@import create, { State } from "zustand";import { COLORS_NOTE } from "../utils/color-scheme";-import { LiteralUnion } from "../utils/types";+import {+ ColorType,+ MonographType,+ NotebookType,+ TagType,+ TopicType+} from "../utils/types";+import { ColorKey } from "./use-theme-store";-export type RouteName =- | "Notes"- | "Notebooks"- | "Notebook"- | "NotesPage"- | "Tags"- | "Favorites"- | "Trash"- | "Search"- | "Settings"- | "TaggedNotes"- | "ColoredNotes"- | "TopicNotes"- | "Monographs";+export type GenericRouteParam = { [name: string]: unknown };-export type Route = LiteralUnion<RouteName>;+export type NotebookScreenParams = {+ item: NotebookType;+ title: string;+ canGoBack: boolean;+};++export type NotesScreenParams = {+ item: TopicType | TagType | ColorType | MonographType;+ title: string;+ canGoBack: boolean;+};++export type AppLockRouteParams = {+ welcome: boolean;+ canGoBack: boolean;+};++export type AuthParams = {+ mode: number;+ title: string;+ canGoBack: boolean;+};++export type RouteParams = {+ Notes: GenericRouteParam;+ Notebooks: GenericRouteParam;+ Notebook: NotebookScreenParams;+ NotesPage: NotesScreenParams;+ Tags: GenericRouteParam;+ Favorites: GenericRouteParam;+ Trash: GenericRouteParam;+ Search: GenericRouteParam;+ Settings: GenericRouteParam;+ TaggedNotes: NotesScreenParams;+ ColoredNotes: NotesScreenParams;+ TopicNotes: NotesScreenParams;+ Monographs: NotesScreenParams;+ AppLock: AppLockRouteParams;+ Auth: AuthParams;+};++export type RouteName = keyof RouteParams;export type CurrentScreen = {- name: Route;+ name: RouteName;id?: string;title?: string;type?: string;- color?: null;+ color?: string | null;alias?: string;notebookId?: string;};@@ -55,11 +90,13 @@ const useNavigationStore = create<NavigationStore>((set, get) => ({title: "Notes",type: "notes"},- currentScreenRaw: { name: "notes" },+ currentScreenRaw: { name: "Notes" },canGoBack: false,update: (currentScreen, canGoBack, headerRightButtons) => {- //@ts-ignore- const color = COLORS_NOTE[currentScreen.color?.toLowerCase()];+ const color =+ COLORS_NOTE[+ currentScreen.color?.toLowerCase() as keyof typeof COLORS_NOTE+ ];if (JSON.stringify(currentScreen) === JSON.stringify(get().currentScreenRaw))diff --git a/apps/mobile/app/stores/use-notebook-store.ts b/apps/mobile/app/stores/use-notebook-store.tsindex 884986e9c..471a9380f 100644--- a/apps/mobile/app/stores/use-notebook-store.ts+++ b/apps/mobile/app/stores/use-notebook-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport { groupArray } from "@streetwriters/notesnook-core/utils/grouping";import create, { State } from "zustand";import { db } from "../common/database";diff --git a/apps/mobile/app/stores/use-notes-store.ts b/apps/mobile/app/stores/use-notes-store.tsindex fc597ce1c..f8644d0df 100644--- a/apps/mobile/app/stores/use-notes-store.ts+++ b/apps/mobile/app/stores/use-notes-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport { groupArray } from "@streetwriters/notesnook-core/utils/grouping";import create, { State } from "zustand";import { db } from "../common/database";diff --git a/apps/mobile/app/stores/use-selection-store.ts b/apps/mobile/app/stores/use-selection-store.tsindex 5005b92ad..1bff5c410 100644--- a/apps/mobile/app/stores/use-selection-store.ts+++ b/apps/mobile/app/stores/use-selection-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport create, { State } from "zustand";import { history } from "../utils";@@ -19,8 +18,7 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({selectedItemsList: [],selectionMode: false,setAll: (all) => {- //@ts-ignore- history.selectedItemsList = all;+ history.selectedItemsList = all as never[];set({ selectedItemsList: all });},setSelectionMode: (mode) => {@@ -36,16 +34,15 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({});},setSelectedItem: (item) => {- let selectedItems = get().selectedItemsList;- const index = selectedItems.findIndex((i) => i.id === item.id);+ let selectedItems = get().selectedItemsList as Item[];+ const index = selectedItems.findIndex((i) => (i as Item).id === item.id);if (index !== -1) {selectedItems.splice(index, 1);} else {selectedItems.push(item);}selectedItems = [...new Set(selectedItems)];- //@ts-ignore- history.selectedItemsList = selectedItems;+ history.selectedItemsList = selectedItems as never[];history.selectionMode =selectedItems.length > 0 ? get().selectionMode : false;set({diff --git a/apps/mobile/app/stores/use-setting-store.ts b/apps/mobile/app/stores/use-setting-store.tsindex f7e9a4a2f..ed5bc2cf5 100644--- a/apps/mobile/app/stores/use-setting-store.ts+++ b/apps/mobile/app/stores/use-setting-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport { Dimensions } from "react-native";import Config from "react-native-config";import { FileType } from "react-native-scoped-storage";@@ -46,7 +45,7 @@ export type Settings = {doubleSpacedLines?: boolean;};-type Dimensions = {+type DimensionsType = {width: number;height: number;};@@ -55,11 +54,11 @@ export interface SettingStore extends State {settings: Settings;fullscreen: boolean;deviceMode: string | null;- dimensions: Dimensions;+ dimensions: DimensionsType;setSettings: (settings: Settings) => void;setFullscreen: (fullscreen: boolean) => void;setDeviceMode: (mode: string) => void;- setDimensions: (dimensions: Dimensions) => void;+ setDimensions: (dimensions: DimensionsType) => void;appLoading: boolean;setAppLoading: (appLoading: boolean) => void;setSheetKeyboardHandler: (sheetKeyboardHandler: boolean) => void;diff --git a/apps/mobile/app/stores/use-tag-store.ts b/apps/mobile/app/stores/use-tag-store.tsindex 36dcebf13..065a65ced 100644--- a/apps/mobile/app/stores/use-tag-store.ts+++ b/apps/mobile/app/stores/use-tag-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport "@streetwriters/notesnook-core/types";import { groupArray } from "@streetwriters/notesnook-core/utils/grouping";import create, { State } from "zustand";diff --git a/apps/mobile/app/stores/use-theme-store.ts b/apps/mobile/app/stores/use-theme-store.tsindex a1dea6f67..919908332 100644--- a/apps/mobile/app/stores/use-theme-store.ts+++ b/apps/mobile/app/stores/use-theme-store.ts@@ -14,3 +14,5 @@ export const useThemeStore = create<ThemeStore>((set) => ({set({ colors });}}));++export type ColorKey = keyof ThemeStore["colors"];diff --git a/apps/mobile/app/stores/use-trash-store.ts b/apps/mobile/app/stores/use-trash-store.tsindex db0b36776..96ed2a597 100644--- a/apps/mobile/app/stores/use-trash-store.ts+++ b/apps/mobile/app/stores/use-trash-store.ts@@ -1,4 +1,3 @@-//@ts-ignoreimport { groupArray } from "@streetwriters/notesnook-core/utils/grouping";import create, { State } from "zustand";import { db } from "../common/database";diff --git a/apps/mobile/app/utils/global-refs.ts b/apps/mobile/app/utils/global-refs.tsindex 6e74f56c2..3300a70e2 100644--- a/apps/mobile/app/utils/global-refs.ts+++ b/apps/mobile/app/utils/global-refs.ts@@ -2,8 +2,9 @@ import { createNavigationContainerRef } from "@react-navigation/native";import { createRef } from "react";import { TextInput, View } from "react-native";import { TabsRef } from "../components/tabs";+import { RouteParams } from "../stores/use-navigation-store";export const inputRef = createRef<TextInput>();-export const rootNavigatorRef = createNavigationContainerRef();+export const rootNavigatorRef = createNavigationContainerRef<RouteParams>();export const tabBarRef = createRef<TabsRef>();export const editorRef = createRef<View>();diff --git a/apps/mobile/app/utils/types.ts b/apps/mobile/app/utils/types.tsindex 498802fe9..a2afde0a9 100644--- a/apps/mobile/app/utils/types.ts+++ b/apps/mobile/app/utils/types.ts@@ -79,6 +79,7 @@ export interface NoteType extends Entity<"note"> {content?: {data: string;type: string;+ isPreview?: boolean;};}@@ -97,6 +98,7 @@ export interface TopicType extends Entity<"topic"> {notes: string[];dateCreated: number;dateEdited: number;+ alias?: string;}export interface AttachmentType extends Entity<"attachment"> {