20 Mistakes That Quietly Destroy JavaScript/TypeScript Codebases (Part 1)

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A practical guide covering 11 common mistakes in JavaScript and TypeScript codebases, organized into three categories: type safety (not enabling strict mode, overusing `any`, missing discriminated unions, skipping explicit return types), error handling (swallowing errors, unhandled promise rejections, the Result pattern), and architecture (hardcoded dependencies, premature microservices, god functions, business logic in controllers, and circular module dependencies). Each mistake includes a before/after code example with clear explanations of why the pattern is harmful and how to fix it.

14m read timeFrom thetshaped.dev
Post cover image
Table of contents
Issues that fix themselves? (Sentry Seer, Partner)1. Not Enabling TypeScript Strict Mode2. Using any as an Escape Hatch3. Not Using Discriminated Unions4. Ignoring Return Types on Exported Functions5. Catching Errors and Swallowing Them6. Not Handling Promise Rejections8. Over-Engineering with Microservices Too Early9. Writing 100+ Line Functions10. Putting Business Logic in Controllers11. Circular Dependencies Between Modules📌 TL;DR

Sort: