fix(types): corrige useRef sem argumento após @types/react 19 - #129
Conversation
@types/react@19 removeu o overload de useRef<T>() sem valor inicial; com strictNullChecks ligado isso vira "Expected 1 arguments, but got 0" (TS2554). 14 ocorrencias em 11 arquivos, todas useRef<X>() -> useRef<X | undefined>(undefined) - mesmo valor inicial de hoje (undefined), zero mudanca de comportamento em runtime. Baseline do typecheck ratchet atualizado: 147 -> 133 ocorrencias. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDFCBv9FvzHkwHCN6YcKVa
There was a problem hiding this comment.
adm01-debug has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedNext included review available in 39 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 97 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (12)
💤 Files with no reviewable changes (1)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughAs referências de temporizadores, animação e monitoramento passam a declarar explicitamente ChangesTipagem explícita de referências
Estimated code review effort: 2 (Simple) | ~10 minutos Merge Risk: ⚪ Minimal · up to This PR makes a localized TypeScript compatibility fix while preserving the existing undefined sentinel and runtime behavior. No actionable merge-blocking risk remains after normal checks and review. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
adm01-debug has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
adm01-debug has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
🟢 Approval recommended
As mudanças são mecânicas e consistentes, mantendo o sentinela undefined e apenas eliminando TS2554 sem introduzir alteração de lógica observável.
Pull request overview
Este PR ajusta chamadas useRef<T>() sem argumento inicial para serem compatíveis com @types/react@19, que removeu o overload sem valor inicial quando strictNullChecks está ativo, eliminando erros TS2554 sem alterar o comportamento em runtime.
Changes:
- Atualiza 11 refs de
useRef<T>()parauseRef<T | undefined>(undefined)mantendoundefinedcomo sentinela. - Remove entradas agora resolvidas (
TS2554) doscripts/ci/typecheck-baseline.json, reduzindo o baseline (147 → 133). - Mantém lógica existente de cancelamento/cleanup (timers/RAF) e checks explícitos contra
undefinedonde aplicável.
File summaries
| File | Description |
|---|---|
| src/hooks/system/useResourcePrefetch.ts | Ajusta timeoutRef para `useRef<... |
| src/hooks/performance/useTimingHooks.ts | Ajusta refs de RAF/tempo para `... |
| src/hooks/performance/useMonitoring.ts | Ajusta startTime ref para aceitar undefined e inicializa explicitamente. |
| src/hooks/performance/useDataOptimization.ts | Ajusta timeoutRef para `... |
| src/hooks/integrations/useKnowledgeBaseSearch.ts | Ajusta debounceRef para `... |
| src/hooks/crm/useContactsSearch.ts | Ajusta debounceRef para `... |
| src/hooks/communication/useVoiceAgent.ts | Ajusta refs de timers (setTimeout) para `... |
| src/hooks/analytics/usePerformanceOptimizations.ts | Ajusta lastCallTimer para `... |
| src/components/mobile/MobileSlidePanel.tsx | Ajusta timerRef do long-press para `... |
| src/components/contacts/useContactFormValidation.ts | Ajusta dupCheckTimer para `... |
| src/components/contacts/ContactForm.tsx | Ajusta empresaBlurTimer para `... |
| scripts/ci/typecheck-baseline.json | Remove ocorrências TS2554 agora resolvidas do baseline do typecheck ratchet. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
bun audit reportava 47 vulnerabilidades (1 critica, 46 altas). Corrigidas as 2 que tinham fix direto disponivel via npm registry: - vitest 4.0.18 -> 4.1.11: critica (GHSA-5xrq-8626-4rwp, leitura arbitraria de arquivo quando o UI server do Vitest esta escutando) - postcss 8.5.6 -> 8.5.26: 2 altas (GHSA-6g55-p6wh-862q, GHSA-r28c-9q8g-f849, disclosure via sourceMappingURL malicioso) Resultado real (bun audit rodado apos o fix): 47 -> 43 vulnerabilidades, 0 criticas. Validado: build ok, 2525/2525 testes unitarios + 167 contract tests passando, lint ratchet e typecheck ratchet sem novas ocorrencias. Nao corrigidas nesta rodada (documentado, nao ignorado): - xlsx <0.19.3: SheetJS nunca publicou a versao corrigida no registry npm (fica em 0.18.5 la), o patch so existe via CDN proprio deles (cdn.sheetjs.com) - trocar a fonte do pacote e uma decisao de supply-chain que exige aprovacao explicita, nao um bump de rotina. - picomatch, ws, fast-uri, browserslist, @babel/plugin-transform-modules-systemjs: todas transitivas de tooling de build/dev (vite, vitest, eslint, tailwindcss, vite-plugin-pwa), nao chegam ao bundle de producao. picomatch tem 2 faixas vulneraveis em majors diferentes (2.x e 4.x) puxadas por cadeias de dependencia distintas - forcar uma versao via override quebraria uma das duas sem validacao individual de cada consumidor. @babel/plugin-transform-modules-systemjs so tem fix na v8 (breaking, o resto do babel aqui e 7.x). Risco pratico baixo (ReDoS em matching de glob durante build local/CI, nao alcancavel por usuario final). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDFCBv9FvzHkwHCN6YcKVa
There was a problem hiding this comment.
adm01-debug has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…cubic) O bump direto de postcss (commit anterior) nao alcancava a copia aninhada lovable-tagger > tailwindcss > postcss@8.5.6, ainda na faixa vulneravel (<=8.5.11) - achado real do bot cubic no PR, verificado no bun.lock antes de aplicar o fix. lovable-tagger continua em uso (vite.config.ts), entao a correcao e "overrides" no package.json forcando todo o grafo de dependencias a resolver postcss em ^8.5.26, em vez de remover/trocar a lib. bun audit: 43 -> 38 vulnerabilidades, zero linha de postcss restante. Validado: build ok, 2525/2525 testes unitarios (32 skipped, mesmo baseline), lint ratchet e typecheck ratchet sem novas ocorrencias. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UDFCBv9FvzHkwHCN6YcKVa
There was a problem hiding this comment.
adm01-debug has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
adm01-debug has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
📝 Descrição
Segue o PR #128 (já mergeado).
@types/react@19removeu o overload deuseRef<T>()sem valor inicial — comstrictNullChecksligado (ligado naquele PR), isso viraTS2554: Expected 1 arguments, but got 0.14 ocorrências em 11 arquivos, todas
useRef<X>()→useRef<X | undefined>(undefined)— mesmo valor inicial de hoje (undefined), zero mudança de comportamento em runtime. Verifiquei arquivo por arquivo se algum consumidor comparava o ref contraundefinedde um jeito que trocar paranullquebraria (achei um caso real,useTimingHooks.ts:56) — por isso mantiveundefinedcomo sentinela em vez de padronizar paranull(convenção usada em outros arquivos do repo), evitando qualquer risco de mudança de lógica.Baseline do typecheck ratchet atualizado: 147 → 133 ocorrências.
🎯 Tipo de Mudança
🧪 Testes Realizados
node scripts/ci/typecheck-ratchet.mjs(133/133, 0 novas),node scripts/ci/lint-ratchet.mjs(0 novas),bun run build(ok),bun run test(2525/2525 passando, 32 skipped — mesmo baseline de antes)✅ Checklist
Diff mecânico e de baixo risco — só assinatura de tipo, sem mudança de lógica. O único ponto que exigiu atenção (
useTimingHooks.ts) está documentado acima.🤖 Generated with Claude Code
https://claude.ai/code/session_01UDFCBv9FvzHkwHCN6YcKVa
Summary by cubic
Fixes 14
useRef<T>()calls across 11 files for@types/react@19, which removed the no-argument overload and causedTS2554; each now initializes withundefined, preserving runtime behavior. Updatesvitestandpostcss, forcing nested dependencies to use the fixed PostCSS version and eliminating the critical audit finding.bun auditfindings from 47 to 38 with no critical findings; the remaining findings affectxlsxor transitive build tooling and require separate supply-chain, override, or breaking-upgrade decisions.Written for commit 1dac997. Summary will update on new commits.
Summary by CodeRabbit
Correções
Qualidade