The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix ts errors
Steven Tey3f8d75691f91
diff --git a/apps/web/app/proxy/[domain]/[key]/page.tsx b/apps/web/app/proxy/[domain]/[key]/page.tsxindex 5c044d9cc6..9c9b262f93 100644--- a/apps/web/app/proxy/[domain]/[key]/page.tsx+++ b/apps/web/app/proxy/[domain]/[key]/page.tsx@@ -19,7 +19,7 @@ export async function generateMetadata({const data = await getLinkViaEdge(domain, key);- if (!data || data.proxy === 0) {+ if (!data?.proxy) {return;}@@ -49,7 +49,7 @@ export default async function ProxyPage({notFound();// if the link does not have proxy enabled, redirect to the original URL- } else if (data.proxy === 0) {+ } else if (!data?.proxy) {redirect(data.url);}diff --git a/apps/web/lib/planetscale.ts b/apps/web/lib/planetscale.tsindex 6ad97a8324..57c938cf9a 100644--- a/apps/web/lib/planetscale.ts+++ b/apps/web/lib/planetscale.ts@@ -1,5 +1,5 @@import { connect } from "@planetscale/database";-import { DomainProps, LinkProps } from "./types";+import { DomainProps, EdgeLinkProps } from "./types";export const pscale_config = {url: process.env.DATABASE_URL,@@ -17,7 +17,7 @@ export const getLinkViaEdge = async (domain: string, key: string) => {)) || {};return rows && Array.isArray(rows) && rows.length > 0- ? (rows[0] as LinkProps)+ ? (rows[0] as EdgeLinkProps): null;};diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.tsindex 5e3fcbe84e..5da3f5c635 100644--- a/apps/web/lib/types.ts+++ b/apps/web/lib/types.ts@@ -28,6 +28,22 @@ export interface RedisLinkProps {banned?: boolean;}+export interface EdgeLinkProps {+ id: string;+ domain: string;+ key: string;+ url: string;+ proxy: boolean;+ title: string;+ description: string;+ image: string;+ password: string;+ clicks: number;+ publicStats: boolean;+ userId: string;+ projectId: string;+}+export interface TagProps {id: string;name: string;