TypeScript's Default tsc Command Can Miss Real Errors in React Projects
A developer deployed a React and TypeScript project that immediately showed an error screen in production, despite the typechecker and build both passing cleanly. The root cause was that the project's root tsconfig.json uses project references and an empty files array, causing plain npx tsc --noEmit to check no source files at all and exit without errors. The actual type error — caused by an unused icon named Map imported from lucide-react shadowing JavaScript's global Map constructor — only surfaced when running tsc against tsconfig.app.json directly. Modern bundlers compound the problem by stripping types rather than checking them, meaning a successful build offers no type safety guarantee. The incident highlights that many scaffolded React and TypeScript repositories share this configuration layout, making the default typecheck command a silent no-op across a large number of codebases.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in