๐Ÿง 

TypeScript End-to-End

Strict TS across UI, API, and server code. Shared types for reports, leads, intake.

Part of the StackSwap Intelligence Ecosystem โ€” software adoption intelligence for the AI era.

What Is the StackSwap TypeScript Setup?

StackSwap uses TypeScript in strict mode across every layer: React components, API routes, server-only modules (`lib/server/*`), and the Supabase access layer. Shared types (e.g. StackscanReport, StackTransformationPlanRow, VerdictRow) live in `lib/` and are imported by both the UI and the API/worker code, so the same contract describes a report whether it is being written to Supabase, rendered in a component, or returned from a JSON endpoint.

How It Fits the StackSwap Intelligence Ecosystem

Because every boundary is typed, a schema change in the StackScan pipeline propagates to the UI, paid results page, and API at compile time. Types for intake, verdicts, and recommendations flow through `scanStack()` โ†’ `verdictsToToolSavingsRows()` โ†’ `buildStackTransformationPlanRows()` โ†’ `applyLlmRecommendationsToRows()` without `any` escape hatches. Branded types (report ids, tool names) catch misuses that would otherwise only surface at runtime.

Why This Matters for Correctness and Refactors

Strict, end-to-end TypeScript is the safety net that lets StackSwap ship large refactors (adding paid results, wiring Stripe, rebuilding intake) without a fleet of manual regression tests. The type system is the first reviewer on every change.