Skip to content

Commit d1f4959

Browse files
committed
chore: enable strict:true
1 parent f61ccdc commit d1f4959

File tree

32 files changed

+116
-68
lines changed

32 files changed

+116
-68
lines changed

apps/web/next.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const nextConfig: NextConfig = {
7777
destination: `/news`,
7878
permanent: true,
7979
},
80-
...rewritesAndRedirectsJson.redirects.map((redirect) => ({
80+
...rewritesAndRedirectsJson.redirects.map((redirect: Redirect) => ({
8181
...redirect,
8282
permanent: redirect.permanent ?? true,
8383
})),
@@ -213,7 +213,7 @@ const nextConfig: NextConfig = {
213213
// https://github.com/vercel/next.js/issues/71638
214214
sassOptions: {
215215
logger: {
216-
warn: function (message) {
216+
warn: function (message: string) {
217217
if (
218218
message.includes("deprecat") ||
219219
message.includes("declarations that appear after nested")

apps/web/openspec/changes/enforce-ts-strict/tasks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
## 1. Enable strict: true (Phase 1)
44

5-
- [ ] 1.1 Set `"strict": true` and `"strictNullChecks": true` in `apps/web/tsconfig.json`
6-
- [ ] 1.2 Run `pnpm tsc --noEmit` and collect all errors
7-
- [ ] 1.3 Fix null/undefined violations (TS2531/TS2532) — use `?.`, `??`, or explicit guards; avoid `!` non-null assertions
8-
- [ ] 1.4 Fix remaining strict errors in existing `.ts`/`.tsx` files (noImplicitAny, strictPropertyInitialization, noImplicitThis)
5+
- [x] 1.1 Set `"strict": true` and `"strictNullChecks": true` in `apps/web/tsconfig.json`
6+
- [x] 1.2 Run `pnpm tsc --noEmit` and collect all errors
7+
- [x] 1.3 Fix null/undefined violations (TS2531/TS2532) — use `?.`, `??`, or explicit guards; avoid `!` non-null assertions
8+
- [x] 1.4 Fix remaining strict errors in existing `.ts`/`.tsx` files (noImplicitAny, strictPropertyInitialization, noImplicitThis)
99

1010
## 2. Convert utilities, hooks, lib, constants (Phase 2)
1111

apps/web/src/app/[locale]/developers/evm-to-svm/erc4626/developers-evm-to-svm-erc4626.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function DevelopersEvmToSvmErc4626Page() {
100100
</td>
101101
<td style={tableCellStyle}>{t(row.objectKey)}</td>
102102
<td style={tableCellStyle}>
103-
{"purposeParts" in row ? (
103+
{"purposeParts" in row && row.purposeParts ? (
104104
row.purposeParts.map((part, partIndex) => {
105105
if (part.type === "code") {
106106
return (

apps/web/src/app/[locale]/developers/nfts/developers-nfts.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ResponsiveBox } from "@/component-library/responsive-box";
44
import {
55
CardDeck,
66
CommunityGallery,
7-
FeatureHighlight,
7+
FeatureHighlight as FeatureHighlightBase,
88
Heading,
99
Hero,
1010
Stats,
@@ -27,6 +27,9 @@ import {
2727
} from "@/data/developers/nfts";
2828
import { useTranslations } from "next-intl";
2929

30+
// Cast to avoid valueOf() type conflict in solana-lib types (upstream issue)
31+
const FeatureHighlight = FeatureHighlightBase as React.ComponentType<any>;
32+
3033
export function DevelopersNftsPage() {
3134
const t = useTranslations("developers-nfts");
3235
const blockSpacing = { large: { marginTop: "20px" } };
@@ -159,7 +162,6 @@ export function DevelopersNftsPage() {
159162
desktopBackground={FEATURE_HIGHLIGHT.desktopBackground}
160163
cards={featureHighlightCards as any}
161164
buttons={featureHighlightButtons as any}
162-
valueOf={null}
163165
/>
164166
<Heading
165167
eyebrow={t("headings.earlyMovers.eyebrow")}

apps/web/src/app/[locale]/developers/payments/developers-payments.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ResponsiveBox } from "@/component-library/responsive-box";
44
import {
55
CardDeck,
66
ConversionPanel,
7-
FeatureHighlight,
7+
FeatureHighlight as FeatureHighlightBase,
88
Heading,
99
Hero,
1010
Stats,
@@ -25,6 +25,9 @@ import {
2525
} from "@/data/developers/payments";
2626
import { useTranslations } from "next-intl";
2727

28+
// Cast to avoid valueOf() type conflict in solana-lib types (upstream issue)
29+
const FeatureHighlight = FeatureHighlightBase as React.ComponentType<any>;
30+
2831
export function DevelopersPaymentsPage() {
2932
const t = useTranslations("developers-payments");
3033
const blockSpacing = { large: { marginTop: "20px" } };
@@ -108,7 +111,6 @@ export function DevelopersPaymentsPage() {
108111
desktopBackground={FEATURE_HIGHLIGHT.desktopBackground}
109112
cards={featureHighlightCards as any}
110113
buttons={[]}
111-
valueOf={null}
112114
/>
113115
</ResponsiveBox>
114116
<ResponsiveBox responsiveStyles={blockSpacing}>

apps/web/src/app/[locale]/home.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ interface HomePageProps {
7676
communitySubtitle: string;
7777
communityLinksTranslations: { title: string; description: string }[];
7878
};
79-
events: (Omit<CalendarEvent, "schedule"> & {
80-
schedule: CalendarEvent["schedule"] & { from: string; to: string };
81-
})[];
79+
events: CalendarEvent[];
8280
firstFeaturedEventIndex: number;
8381
videos: YouTubePlaylistItem[];
8482
news: PostItem[];
@@ -130,8 +128,8 @@ export function HomePage({
130128
return eventDate >= oneWeekAgo;
131129
})
132130
.sort((a, b) => {
133-
const dateA = new Date(a.schedule.from).getTime();
134-
const dateB = new Date(b.schedule.from).getTime();
131+
const dateA = new Date(a.schedule.from ?? 0).getTime();
132+
const dateB = new Date(b.schedule.from ?? 0).getTime();
135133
return dateA - dateB;
136134
});
137135
}, [events]);
@@ -212,8 +210,8 @@ export function HomePage({
212210
key={event.key}
213211
imageSrc={event.img.primary || defaultImg.src}
214212
title={event.title}
215-
date={event.schedule.from}
216-
location={event.venue.city || event.venue.address}
213+
date={event.schedule.from ?? undefined}
214+
location={event.venue.city ?? event.venue.address ?? undefined}
217215
href={event.rsvp}
218216
className="px-1"
219217
/>
@@ -279,7 +277,7 @@ export function HomePage({
279277
<BigBannerCard
280278
key={item.id}
281279
className="px-1"
282-
imageSrc={item.heroImage}
280+
imageSrc={item.heroImage ?? ""}
283281
title={item.title}
284282
description={item.description}
285283
href={item.url}
@@ -299,8 +297,11 @@ export function HomePage({
299297
{videos.map((item) => (
300298
<BigVideoCard
301299
key={item.id}
302-
id={item.contentDetails.videoId}
303-
thumbnail={item.snippet.thumbnails.maxres.url}
300+
id={item.contentDetails?.videoId ?? ""}
301+
thumbnail={
302+
item.snippet.thumbnails.maxres?.url ??
303+
item.snippet.thumbnails.high.url
304+
}
304305
alt={item.snippet.title}
305306
className="px-1"
306307
title={item.snippet.title}

apps/web/src/app/[locale]/solutions/actions/solutions-actions.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Slider,
1010
ConversionPanel,
1111
Accordion,
12-
FeatureHighlight,
12+
FeatureHighlight as FeatureHighlightBase,
1313
HtmlParser,
1414
} from "@solana-foundation/solana-lib";
1515
import { ResponsiveBox } from "@/component-library/responsive-box";
@@ -26,6 +26,9 @@ import {
2626
VIDEO_SOURCE,
2727
} from "@/data/solutions/actions";
2828

29+
// Cast to avoid valueOf() type conflict in solana-lib types (upstream issue)
30+
const FeatureHighlight = FeatureHighlightBase as React.ComponentType<any>;
31+
2932
export function ActionsPage() {
3033
const t = useTranslations("actions-solution");
3134

@@ -289,7 +292,6 @@ export function ActionsPage() {
289292
body={t("headings.aboutSolana.body")}
290293
dynamicDataFootnote="Live data"
291294
headingAs="h3"
292-
valueOf={null}
293295
/>
294296
</ResponsiveBox>
295297
</>

apps/web/src/app/[locale]/wallets/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ export default async function Page(_props: Props) {
5959
const compareWalletsButton = {
6060
...cmpRest,
6161
label: t(COMPARE_WALLETS_BUTTON.labelKey),
62-
} as React.ComponentProps<typeof ConversionPanel>["buttons"][number];
62+
} as NonNullable<
63+
React.ComponentProps<typeof ConversionPanel>["buttons"]
64+
>[number];
6365

6466
const { labelKey: _appKey, ...appRest } = APPLY_FOR_GRANT_BUTTON;
6567
const applyForGrantButton = {
6668
...appRest,
6769
label: t(APPLY_FOR_GRANT_BUTTON.labelKey),
68-
} as React.ComponentProps<typeof ConversionPanel>["buttons"][number];
70+
} as NonNullable<
71+
React.ComponentProps<typeof ConversionPanel>["buttons"]
72+
>[number];
6973

7074
const translations = {
7175
heroEyebrow: t("hero.eyebrow"),

apps/web/src/app/[locale]/wallets/wallets.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ interface WalletsPageProps {
5757
buildCards: React.ComponentProps<typeof CardDeck>["cards"];
5858
buyCards: React.ComponentProps<typeof CardDeck>["cards"];
5959
developerCards: React.ComponentProps<typeof CardDeck>["cards"];
60-
compareWalletsButton: React.ComponentProps<
61-
typeof ConversionPanel
62-
>["buttons"][number];
63-
applyForGrantButton: React.ComponentProps<
64-
typeof ConversionPanel
65-
>["buttons"][number];
60+
compareWalletsButton: NonNullable<
61+
React.ComponentProps<typeof ConversionPanel>["buttons"]
62+
>[number];
63+
applyForGrantButton: NonNullable<
64+
React.ComponentProps<typeof ConversionPanel>["buttons"]
65+
>[number];
6666
}
6767

6868
export function WalletsPage({

apps/web/src/component-library/badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Badge: React.FC<BadgeProps> = ({ className, title, LeftIcon }) => {
2929
height={0}
3030
alt=""
3131
/>
32-
) : Boolean(LeftIcon) ? (
32+
) : LeftIcon ? (
3333
<LeftIcon size={20} />
3434
) : null}
3535
<span className="px-1.5 inline-block align-middle pt-0.5">{title}</span>

0 commit comments

Comments
 (0)