Menu

1 / 2

How `tsc` Crashes With 14 Lines of Recursive Types (And What TS 6 Doesn't Fix)

DEV Community·Gabriel Anhaia·7 months ago
#qs4p2nQA
Reading 0:00
15s threshold

Book: The TypeScript Type System — From Generics to DSL-Level Types

Also by me: The TypeScript Library — the 5-book collection

My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools

Me: xgabriel.com | GitHub

You open a tRPC router on a Monday. The router speaks to a Drizzle schema with about four hundred columns across thirty tables. The procedure inputs are validated with Zod. Everything was fine on Friday. Today, your editor is grey. The TypeScript server has been spinning for ninety seconds. When it finally answers, the message is the one every TypeScript developer eventually meets:

error TS2589: Type instantiation is excessively deep and possibly infinite.

Enter fullscreen mode

Exit fullscreen mode

You did not write a recursive type. You imported three libraries that did, and the composition of their types pushed the checker past the wall.

The wall is real. It has a number. It is 1000 . TypeScript 6 did not move it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.