Fix some any types
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import { LinkRequestQuery, Sort } from "@/types/global";
|
||||
import { LinkRequestQuery, Order, Sort } from "@/types/global";
|
||||
|
||||
export default async function getDashboardData(
|
||||
userId: number,
|
||||
query: LinkRequestQuery
|
||||
) {
|
||||
let order: any;
|
||||
let order: Order = { id: "desc" };
|
||||
if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };
|
||||
else if (query.sort === Sort.DateOldestFirst) order = { id: "asc" };
|
||||
else if (query.sort === Sort.NameAZ) order = { name: "asc" };
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import { LinkRequestQuery, Sort } from "@/types/global";
|
||||
import { LinkRequestQuery, Order, Sort } from "@/types/global";
|
||||
|
||||
type Response<D> =
|
||||
| {
|
||||
data: D;
|
||||
message: string;
|
||||
status: number;
|
||||
}
|
||||
data: D;
|
||||
message: string;
|
||||
status: number;
|
||||
}
|
||||
| {
|
||||
data: D;
|
||||
message: string;
|
||||
status: number;
|
||||
};
|
||||
data: D;
|
||||
message: string;
|
||||
status: number;
|
||||
};
|
||||
|
||||
export default async function getDashboardData(
|
||||
userId: number,
|
||||
query: LinkRequestQuery
|
||||
): Promise<Response<any>> {
|
||||
let order: any;
|
||||
let order: Order = { id: "desc" };
|
||||
if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };
|
||||
else if (query.sort === Sort.DateOldestFirst) order = { id: "asc" };
|
||||
else if (query.sort === Sort.NameAZ) order = { name: "asc" };
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import { LinkRequestQuery, Sort } from "@/types/global";
|
||||
import { LinkRequestQuery, Order, Sort } from "@/types/global";
|
||||
|
||||
export default async function getLink(userId: number, query: LinkRequestQuery) {
|
||||
const POSTGRES_IS_ENABLED =
|
||||
process.env.DATABASE_URL?.startsWith("postgresql");
|
||||
|
||||
let order: any;
|
||||
let order: Order = { id: "desc" };
|
||||
if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };
|
||||
else if (query.sort === Sort.DateOldestFirst) order = { id: "asc" };
|
||||
else if (query.sort === Sort.NameAZ) order = { name: "asc" };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { prisma } from "@/lib/api/db";
|
||||
import { LinkRequestQuery, Sort } from "@/types/global";
|
||||
import { LinkRequestQuery, Order, Sort } from "@/types/global";
|
||||
|
||||
export default async function getLink(
|
||||
query: Omit<LinkRequestQuery, "tagId" | "pinnedOnly">
|
||||
@@ -7,7 +7,7 @@ export default async function getLink(
|
||||
const POSTGRES_IS_ENABLED =
|
||||
process.env.DATABASE_URL?.startsWith("postgresql");
|
||||
|
||||
let order: any;
|
||||
let order: Order = { id: "desc" };
|
||||
if (query.sort === Sort.DateNewestFirst) order = { id: "desc" };
|
||||
else if (query.sort === Sort.DateOldestFirst) order = { id: "asc" };
|
||||
else if (query.sort === Sort.NameAZ) order = { name: "asc" };
|
||||
|
||||
+2
-2
@@ -7,10 +7,10 @@ export function isPWA() {
|
||||
}
|
||||
|
||||
export function isIphone() {
|
||||
return /iPhone/.test(navigator.userAgent) && !(window as any).MSStream;
|
||||
return /iPhone/.test(navigator.userAgent) && !(window as unknown as { MSStream?: any }).MSStream;
|
||||
}
|
||||
|
||||
export function dropdownTriggerer(e: any) {
|
||||
export function dropdownTriggerer(e: React.FocusEvent<HTMLElement> | React.MouseEvent<HTMLElement>) {
|
||||
let targetEl = e.currentTarget;
|
||||
if (targetEl && targetEl.matches(":focus")) {
|
||||
setTimeout(function () {
|
||||
|
||||
@@ -39,7 +39,7 @@ export function monolithAvailable(
|
||||
);
|
||||
}
|
||||
|
||||
export function previewAvailable(link: any) {
|
||||
export function previewAvailable(link: LinkIncludingShortenedCollectionAndTags) {
|
||||
return (
|
||||
link &&
|
||||
link.preview &&
|
||||
|
||||
Reference in New Issue
Block a user