chore: Removing some any

This commit is contained in:
Tom Moor
2024-01-05 23:25:05 -05:00
parent 89d905ebb7
commit 140526af06
5 changed files with 10 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ const StyledText = styled(Text)`
`; `;
export const Preview = styled(Link)` export const Preview = styled(Link)`
cursor: ${(props: any) => cursor: ${(props: { as?: string }) =>
props.as === "div" ? "default" : "var(--pointer)"}; props.as === "div" ? "default" : "var(--pointer)"};
border-radius: 4px; border-radius: 4px;
box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3),

View File

@@ -1,6 +1,7 @@
import { Node } from "prosemirror-model"; import { Node } from "prosemirror-model";
import { EditorView } from "prosemirror-view"; import { EditorView } from "prosemirror-view";
import { toast } from "sonner"; import { toast } from "sonner";
import type { Dictionary } from "~/hooks/useDictionary";
function findPlaceholderLink(doc: Node, href: string) { function findPlaceholderLink(doc: Node, href: string) {
let result: { pos: number; node: Node } | undefined; let result: { pos: number; node: Node } | undefined;
@@ -37,7 +38,7 @@ const createAndInsertLink = async function (
title: string, title: string,
href: string, href: string,
options: { options: {
dictionary: any; dictionary: Dictionary;
nested?: boolean; nested?: boolean;
onCreateLink: (title: string, nested?: boolean) => Promise<string>; onCreateLink: (title: string, nested?: boolean) => Promise<string>;
} }

View File

@@ -2,6 +2,7 @@ import * as Sentry from "@sentry/react";
import { EditorView } from "prosemirror-view"; import { EditorView } from "prosemirror-view";
import { toast } from "sonner"; import { toast } from "sonner";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import type { Dictionary } from "~/hooks/useDictionary";
import FileHelper from "../lib/FileHelper"; import FileHelper from "../lib/FileHelper";
import uploadPlaceholderPlugin, { import uploadPlaceholderPlugin, {
findPlaceholder, findPlaceholder,
@@ -9,7 +10,7 @@ import uploadPlaceholderPlugin, {
export type Options = { export type Options = {
/** Dictionary object containing translation strings */ /** Dictionary object containing translation strings */
dictionary: any; dictionary: Dictionary;
/** Set to true to force images and videos to become file attachments */ /** Set to true to force images and videos to become file attachments */
isAttachment?: boolean; isAttachment?: boolean;
/** Set to true to replace any existing image at the users selection */ /** Set to true to replace any existing image at the users selection */

View File

@@ -58,7 +58,7 @@ import zig from "refractor/lang/zig";
import { toast } from "sonner"; import { toast } from "sonner";
import { Primitive } from "utility-types"; import { Primitive } from "utility-types";
import { Dictionary } from "~/hooks/useDictionary"; import type { Dictionary } from "~/hooks/useDictionary";
import { UserPreferences } from "../../types"; import { UserPreferences } from "../../types";
import Storage from "../../utils/Storage"; import Storage from "../../utils/Storage";
import { isMac } from "../../utils/browser"; import { isMac } from "../../utils/browser";

View File

@@ -1,3 +1,5 @@
import { Primitive } from "utility-types";
/** /**
* Storage is a wrapper class for localStorage that allow safe usage when * Storage is a wrapper class for localStorage that allow safe usage when
* localStorage is not available. * localStorage is not available.
@@ -41,7 +43,7 @@ class Storage {
* @param fallback The fallback value if the key doesn't exist. * @param fallback The fallback value if the key doesn't exist.
* @returns The value or undefined if it doesn't exist. * @returns The value or undefined if it doesn't exist.
*/ */
public get(key: string, fallback?: any) { public get(key: string, fallback?: Primitive) {
try { try {
const value = this.interface.getItem(key); const value = this.interface.getItem(key);
if (typeof value === "string") { if (typeof value === "string") {
@@ -79,7 +81,7 @@ class MemoryStorage {
return this.data[key] || null; return this.data[key] || null;
} }
setItem(key: string, value: any) { setItem(key: string, value: Primitive) {
return (this.data[key] = String(value)); return (this.data[key] = String(value));
} }