fix(search): restaura quickActions (corrige TS2552 do gate typecheck)#215
Conversation
…orfã pós Etapa 14-16)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 10 minutes and 53 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Fixes a TypeScript regression in the global search idle state by restoring the quickActions identifier, which is referenced via a typeof quickActions[0] type query. This unblocks the tsc -p tsconfig.app.json typecheck baseline gate (TS2552) without intended runtime behavior changes.
Changes:
- Reverts
_quickActionsback toquickActionsso thetypeof quickActions[0]type reference resolves again.
Comments suppressed due to low confidence (1)
src/components/search/GlobalSearchIdleState.tsx:78
quickActionsis only used for thetypeof quickActions[0]type query, so the array (including JSX/SVG) is still created at runtime even though it isn't rendered/consumed. To avoid the extra runtime constant and the fragile “first element” typing, consider introducing an explicitQuickActiontype (e.g., derived fromGlobalSearchIdleStateProps['quickActionsData'][number]) and using that forNavCardinstead oftypeof quickActions[0].
const quickActions = [
{ id: "new-quote", title: "Novo Orçamento", description: "Criar um novo orçamento", icon: <span className="h-4 w-4"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 18v-6"/><path d="M14 18v-3"/></svg></span>, href: "/orcamentos/novo", shortcut: "N", highlight: true },
{ id: "products", title: "Catálogo de Produtos", description: "Ver todos os produtos", icon: <span className="h-4 w-4"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="m7.5 4.27 9 5.15"/><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg></span>, href: "/" },
];
/* ── NavCard ── */
function NavCard({ action, index, onSelect }: {
action: typeof quickActions[0]; index: number; onSelect: (href: string) => void;
}) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Corrige regressão de TypeScript introduzida no #209: a limpeza de unused-vars renomeou
const quickActions→_quickActions, mas o identificador é referenciado em posição de tipo (typeof quickActions[0]), que o codemod não detectou como uso. Resultado: TS2552 no gate de typecheck baseline.Fix: reverte o rename (1 linha).
tsc -p tsconfig.app.jsonvolta a 0 regressões; sem impacto em runtime ou no baseline ESLint.Summary by cubic
Fixes a TypeScript TS2552 in global search by restoring the
quickActionsidentifier (it had been renamed to_quickActions). Thetypeof quickActions[0]type reference compiles again; no runtime or ESLint baseline changes.Written for commit cca89b2. Summary will update on new commits. Review in cubic