diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00ddcc998..9d014abb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,11 @@ jobs: cd website npm run lint + - name: Typecheck + run: | + cd website + npm run typecheck + - name: Test build run: | cd website diff --git a/comment_service/comments.ts b/comment_service/comments.ts index d223338c0..206fd1079 100644 --- a/comment_service/comments.ts +++ b/comment_service/comments.ts @@ -7,7 +7,7 @@ import crypto from "crypto"; // ── Types ─────────────────────────────────────────────────────────────── -interface ScalewayEvent { +export interface ScalewayEvent { httpMethod: string; headers?: Record; queryStringParameters?: Record; @@ -30,7 +30,7 @@ interface CommentPostBody { website?: string; // honeypot field } -interface HandlerResponse { +export interface HandlerResponse { statusCode: number; headers: Record; body: string; diff --git a/comment_service/package.json b/comment_service/package.json index ae21dc7d2..1c2fbda2c 100644 --- a/comment_service/package.json +++ b/comment_service/package.json @@ -13,7 +13,8 @@ "lint:fix": "eslint . --fix", "format": "prettier --write \"**/*.{ts,js,json,md}\"", "format:check": "prettier --check \"**/*.{ts,js,json,md}\"", - "check": "npm run lint && npm run format:check && npm run test:coverage", + "typecheck": "tsc --noEmit", + "check": "npm run lint && npm run format:check && npm run typecheck && npm run test:coverage", "predeploy": "npm run build", "deploy": "serverless deploy", "info": "serverless info", diff --git a/comment_service/test/comments.test.ts b/comment_service/test/comments.test.ts index 37e5daf97..971afa4c6 100644 --- a/comment_service/test/comments.test.ts +++ b/comment_service/test/comments.test.ts @@ -3,6 +3,7 @@ */ import { describe, test, expect, beforeAll, beforeEach, afterEach, vi } from "vitest"; +import type { ScalewayEvent, HandlerResponse } from "../comments"; // Mock the shared S3 client const mockListObjects = vi.fn(); @@ -19,10 +20,10 @@ vi.mock("@fretchen/s3-utils", () => ({ global.fetch = vi.fn() as any; describe("comments.ts", () => { - let handle: (event: Record, context: unknown) => Promise; + let handle: (event: ScalewayEvent, context: unknown) => Promise; beforeAll(async () => { - const module = await import("../comments.ts"); + const module = await import("../comments"); handle = module.handle; }); diff --git a/eth/tsconfig.json b/eth/tsconfig.json index 5dde441f0..897642b6c 100644 --- a/eth/tsconfig.json +++ b/eth/tsconfig.json @@ -8,5 +8,6 @@ "strict": true, "skipLibCheck": true, "resolveJsonModule": true - } + }, + "exclude": ["node_modules", "archive"] } diff --git a/shared/chain-utils/package.json b/shared/chain-utils/package.json index e8951f6cf..49233eb88 100644 --- a/shared/chain-utils/package.json +++ b/shared/chain-utils/package.json @@ -17,10 +17,11 @@ "scripts": { "build": "tsc", "clean": "rm -rf dist", + "typecheck": "tsc --noEmit", "lint": "eslint .", "format": "prettier --check .", "format:fix": "prettier --write .", - "check": "npm run lint && npm run format && npm run test:coverage", + "check": "npm run lint && npm run format && npm run typecheck && npm run test:coverage", "test": "vitest run", "test:watch": "vitest", "test:coverage": "vitest run --coverage" diff --git a/website/components/FacilitatorApproval.tsx b/website/components/FacilitatorApproval.tsx index 163f9f119..b20c64d44 100644 --- a/website/components/FacilitatorApproval.tsx +++ b/website/components/FacilitatorApproval.tsx @@ -168,7 +168,9 @@ export function FacilitatorApproval({ const [fetchError, setFetchError] = useState(null); const networks = showTestnets ? APPROVAL_NETWORKS_WITH_TESTNETS : APPROVAL_NETWORKS; - const [selectedNetwork, setSelectedNetwork] = useState(networks[0].network); + const [selectedNetwork, setSelectedNetwork] = useState<(typeof APPROVAL_NETWORKS_WITH_TESTNETS)[number]["network"]>( + networks[0].network, + ); const usdcConfig = getNetworkUSDCConfig(selectedNetwork); const targetChainId = usdcConfig ? usdcConfig.chainId : fromCAIP2(selectedNetwork); diff --git a/website/components/ImageModal.tsx b/website/components/ImageModal.tsx index 8105b7758..b82168c52 100644 --- a/website/components/ImageModal.tsx +++ b/website/components/ImageModal.tsx @@ -39,7 +39,7 @@ export function ImageModal({ image, onClose }: ImageModalProps) { {image.description &&

{image.description}

} {image.network && }
-
diff --git a/website/components/Link.tsx b/website/components/Link.tsx index 5c42bd84b..ec8942e00 100644 --- a/website/components/Link.tsx +++ b/website/components/Link.tsx @@ -19,7 +19,7 @@ export function Link({ const { urlPathname } = pageContext; if (!locale && pageContext.locale) { - locale = pageContext.locale as string; + locale = pageContext.locale; } if (!locale && !pageContext.locale) { locale = defaultLocale; diff --git a/website/components/MarkdownWithLatex.tsx b/website/components/MarkdownWithLatex.tsx index 71c1a2cb2..75f9274c6 100644 --- a/website/components/MarkdownWithLatex.tsx +++ b/website/components/MarkdownWithLatex.tsx @@ -1,9 +1,9 @@ import React from "react"; -import ReactMarkdown, { type Components } from "react-markdown"; +import ReactMarkdown, { type Components, type Options } from "react-markdown"; interface MarkdownWithLatexProps { children: string; - remarkPlugins?: unknown[]; + remarkPlugins?: Options["remarkPlugins"]; components?: Partial; } @@ -20,10 +20,9 @@ export const MarkdownWithLatex: React.FC = ({ children, // Client-side LaTeX rendering after content is mounted React.useEffect(() => { if (containerRef.current) { - type RenderMathInElement = (element: Element, options?: Record) => void; import("katex/dist/contrib/auto-render") .then((module) => { - const renderMathInElement = (module as { default: RenderMathInElement }).default; + const renderMathInElement = module.default; if (containerRef.current) { renderMathInElement(containerRef.current, { delimiters: [ diff --git a/website/components/Post.tsx b/website/components/Post.tsx index bdc61fcf0..9a3859c0e 100644 --- a/website/components/Post.tsx +++ b/website/components/Post.tsx @@ -19,7 +19,7 @@ import { CommentsSection } from "./CommentsSection"; const ReactPostRenderer: React.FC<{ componentPath: string; tokenID?: number; - contentRef: React.RefObject; + contentRef: React.RefObject; onReady?: () => void; }> = ({ componentPath, tokenID, contentRef, onReady }) => { const [Component, setComponent] = React.useState(null); diff --git a/website/components/SimpleCollectButton.tsx b/website/components/SimpleCollectButton.tsx index ccb8c1cfe..4cc4461ed 100644 --- a/website/components/SimpleCollectButton.tsx +++ b/website/components/SimpleCollectButton.tsx @@ -144,7 +144,7 @@ export function SimpleCollectButton({ genImTokenId }: SimpleCollectButtonProps)