The Symptom
Symptom
Root Cause Analysis
Root Cause
A developer created a clever but overly complex recursive utility type to convert database snake_case keys into camelCase keys for the frontend (using Template Literal Types). While it worked fine for simple objects, when it was applied to a massive nested API response interface with recursive relationships, the TypeScript compiler tried to evaluate thousands of permutations, exhausting the V8 engine's memory.
// The fatal flaw: Recursive template literal types on deep structures
type SnakeToCamelCase<S extends string> = ...
type DeepCamelize<T> = T extends object ? {
[K in keyof T as SnakeToCamelCase<K & string>]: DeepCamelize<T[K]>
} : T;
Discussions 0