Skip to content

Commit 47114df

Browse files
committed
feat(config): enable typedRoutes on all Next.js apps, disable ignoreBuildErrors
- Enable typedRoutes on web, chat-web, tools-web (portal already had it) - Set ignoreBuildErrors: false on web (was dangerously true in production) - Add Route type casts for dynamic hrefs caught by typedRoutes
1 parent daa2018 commit 47114df

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

apps/chat-web/app/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Network,
1010
Share2,
1111
} from "lucide-react";
12+
import type { Route } from "next";
1213
import Link from "next/link";
1314

1415
import { Badge } from "@/components/ui/badge";
@@ -286,7 +287,7 @@ export default function Home() {
286287
</CardHeader>
287288
<CardContent>
288289
<Button asChild className="w-full" variant="secondary">
289-
<Link href={client.href}>Open {client.name}</Link>
290+
<Link href={client.href as Route}>Open {client.name}</Link>
290291
</Button>
291292
</CardContent>
292293
</Card>

apps/chat-web/next.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
22
import type { NextConfig } from "next";
33

44
const nextConfig: NextConfig = {
5+
typedRoutes: true,
56
reactStrictMode: true,
67
poweredByHeader: false,
78
};

apps/tools-web/next.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
22
import type { NextConfig } from "next";
33

4-
const config: NextConfig = {};
4+
const config: NextConfig = {
5+
typedRoutes: true,
6+
};
57

68
export default config;
79

apps/web/next.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import "./src/env";
1414
const monorepoRoot = path.resolve(import.meta.dirname, "..", "..");
1515

1616
const nextConfig: NextConfig = {
17+
typedRoutes: true,
1718
compiler: {
1819
// Remove console logs for better performance in production
1920
// removeConsole:
@@ -158,7 +159,7 @@ const nextConfig: NextConfig = {
158159
},
159160

160161
typescript: {
161-
ignoreBuildErrors: process.env.NODE_ENV === "production",
162+
ignoreBuildErrors: false,
162163
},
163164
};
164165

apps/web/src/app/contribute/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Users,
88
} from "lucide-react";
99
import type { LucideIcon } from "lucide-react";
10-
import type { Metadata } from "next";
10+
import type { Metadata, Route } from "next";
1111
import Link from "next/link";
1212
import {
1313
SiBitcoin,
@@ -233,7 +233,7 @@ export default function ContributePage() {
233233
<Button
234234
render={
235235
<Link
236-
href={way.href}
236+
href={way.href as Route}
237237
rel={way.external ? "noopener noreferrer" : undefined}
238238
target={way.external ? "_blank" : undefined}
239239
/>

apps/web/src/components/blog/blog-posts.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import type { Route } from "next";
34
import Link from "next/link";
45
import { usePathname, useRouter } from "next/navigation";
56
import React, { useCallback, useEffect, useRef, useState } from "react";
@@ -187,12 +188,12 @@ export default function BlogPosts({
187188
setShouldScrollTop(true); // Set flag to scroll on next content update
188189

189190
// Prefetch the new page
190-
router.prefetch(`${pathname}?page=${newPage}`);
191+
router.prefetch(`${pathname}?page=${newPage}` as Route);
191192

192193
// Use a slight delay to ensure prefetching happens
193194
setTimeout(() => {
194195
// Preserve the current URL path and only update the page parameter
195-
router.push(`${pathname}?page=${newPage}`, { scroll: false });
196+
router.push(`${pathname}?page=${newPage}` as Route, { scroll: false });
196197
}, 50);
197198
},
198199
[pathname, router]

apps/web/src/components/layouts/footer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Route } from "next";
12
import Link from "next/link";
23
import { BsOpencollective } from "react-icons/bs";
34
import {
@@ -74,7 +75,7 @@ function FooterLink({ name, href }: { name: string; href: string }) {
7475
{isExternal ? (
7576
<a
7677
className="text-muted-foreground hover:text-foreground text-sm transition-colors"
77-
href={href}
78+
href={href as Route}
7879
rel="noopener noreferrer"
7980
target="_blank"
8081
>
@@ -83,7 +84,7 @@ function FooterLink({ name, href }: { name: string; href: string }) {
8384
) : (
8485
<Link
8586
className="text-muted-foreground hover:text-foreground text-sm transition-colors"
86-
href={href}
87+
href={href as Route}
8788
>
8889
{name}
8990
</Link>

apps/web/src/components/layouts/header.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
Users,
1818
Wrench,
1919
} from "lucide-react";
20+
import type { Route } from "next";
2021
import Link from "next/link";
2122
import { useEffect, useState } from "react";
2223
import { PiLinuxLogoBold } from "react-icons/pi";
@@ -192,7 +193,7 @@ function MenuSubLink({
192193
return (
193194
<Link
194195
className="hover:bg-muted flex w-full items-center gap-3 rounded-lg px-2.5 py-2 transition-colors"
195-
href={link.href}
196+
href={link.href as Route}
196197
onClick={onClick}
197198
rel={isExternal ? "noopener noreferrer" : undefined}
198199
target={isExternal ? "_blank" : undefined}
@@ -283,7 +284,7 @@ function DesktopNavigation() {
283284
navigationMenuTriggerStyle(),
284285
"text-muted-foreground bg-transparent px-3 py-1.5 text-sm font-normal"
285286
)}
286-
render={<Link href={link.href} />}
287+
render={<Link href={link.href as Route} />}
287288
>
288289
{link.label}
289290
</NavigationMenuLink>

0 commit comments

Comments
 (0)