{
  "id": 7902146,
  "title": "--incremental Made My TypeScript Hook 3.6x Slower. A 200KB Threshold Fixed It",
  "url": "https://urgent.news/2026/09/17/incremental-made-my-typescript-hook-3-6x-slower-a-200kb-threshold",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-17T00:00:08.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bokuwalily/-incremental-made-my-typescript-hook-36x-slower-a-200kb-threshold-fixed-it-ed4"
  },
  "original_language": "en",
  "account": "In his journey from freelancing in college to building a successful TypeScript hook, the author encountered a critical issue: making TypeScript faster led to slower performance. The key to this problem lies in how TypeScript compiles projects. When a developer edits a file, TypeScript runs a type check using the PostToolUse hook. This process involves loading the entire dependency graph, which can be slow for larger projects. Initially, the author used the --incremental flag, which improved performance by only re-analyzing the changed files. However, this flag started to backfire on larger projects as the --tsbuildinfo cache file grew in size, making subsequent runs slower. The author discovered that the 200KB threshold of this cache file correlated with project size and performance. When the cache exceeded 200KB, normal compilation mode became faster. By implementing a threshold guard, the hook automatically switches to normal mode for large projects and uses incremental mode for smaller ones. This solution optimizes performance across various project sizes, ensuring smoother development without sacrificing TypeScript's verification capabilities.",
  "summary": "I started freelancing in college at ¥100k a month, stacked side gigs up to ¥600k, then got laid off and dropped to zero overnight. Over the next six months I built an autonomous Claude Code setup from scratch, and it now runs at ¥1.2M a month in revenue. Of everything that went into that, the bug that quietly ate the most time was the one where I tried to make something faster and made it slower…",
  "key_points": [
    "TypeScript hook initially slower with --incremental flag",
    "200KB cache file threshold impacts performance",
    "Incremental mode switch optimizes large projects"
  ],
  "editors_take": "The author's solution optimizes TypeScript hook performance by automatically switching between incremental and normal compilation modes based on project size, ensuring smoother development across various project sizes.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}