# Errors — Falhas para evitar _Registro de erros, exceções e falhas com contexto de reprodução._ --- ## [ERR-20260519-002] tsup-flat-infinity-breaks-dts **Logged**: 2026-05-19T21:35:00-03:00 **Severity**: high **Area**: config | build ### What happened `cn()` usava `flat(Infinity)` no array de classes. O gerador de DTS do tsup v8 quebra com tipos recursivos infinitos, lançando `Type instantiation is excessively deep`. ### Error message ``` src/utils/index.ts: error TS2589: Type instantiation is excessively deep and possibly infinite. DTS Build error ``` ### Reproduction ```ts type ClassValue = string | false | null | undefined | ClassValue[]; // ❌ flat(Infinity) → tipo recursivo infinito → DTS quebra export function cn(...inputs: ClassValue[]): string { return inputs.flat(Infinity).... } ``` ### Fix ```ts type ClassValue = string | boolean | null | undefined | Array; // ✅ flat(2) — máximo de aninhamento é 2 níveis (cls, [cls2]) export function cn(...inputs: ClassValue[]): string { return inputs.flat(2).... } ``` ### Also fixed in same session - `process.env.NODE_ENV` no código → quebra SSR / bundler. Solução: guarda `typeof localStorage !== 'undefined'` - `documentoSchema` usava `.replace()` direto na string Zod → `.transform(v => v.replace(…))` ---