Skip to content

refactor(backend): quitar los any restantes y hacer no-explicit-any error - #10

Merged
bpstack merged 5 commits into
claude/compassionate-planck-gh6aoffrom
opencode/any
Oct 12, 2026
Merged

bpstack merged 5 commits into
claude/compassionate-planck-gh6aoffrom
opencode/any

Conversation

@bpstack

@bpstack bpstack commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Cambios

  • Tipados los any que quedaban en auth, cron, config, scripts y tests.
  • no-explicit-any pasa de aviso a error en el lint del backend.
  • docs/TODO.md: se borra el punto, ya hecho.

Por qué

Los any escondían errores de tipos; con la regla como error no vuelven a entrar.

- user-repository.ts: replace 6 'catch (error: any)' with 'catch (error)' and type assertions for .code and .message access
- user-repository.ts: replace 'as any' with explicit type 'Error & { code?: string }' for the duplicate entry error
- user-controllers.ts: replace 'catch (error: any)' with 'catch (error)' and type assertion for .message access
- Pattern used: (error as { code?: string }).code and (error as Error).message
- db-config.ts: ssl?: any → ssl?: object
- cron-service.ts: results?: any → results?: unknown
- checklist-report.ts: replace 9 any with proper types:
  - Import RowDataPacket from mysql2
  - Define interfaces RunRow, StepRow, CommentRow extending RowDataPacket
  - Use db.query<RowType[]> instead of (db as any).query
  - Replace (d: any) with (d: unknown) in fmt function
  - Remove all (s: any) and (c: any) from callbacks
- demo-restriction.test.ts: replace 9 'as any' with 'as unknown as Request[...]' or 'as unknown' for socket, user, headers, and mock access
- user-repository-login.test.ts: import RowDataPacket, replace db.query<any[]> with db.query<RowDataPacket[]>, replace (user as any) with (user as Record<string, unknown>)
- checklist.test.ts: import RowDataPacket, replace 7 'const [rows]: any' with 'const [rows] = await db.query<RowDataPacket[]>', remove (r: any) from callback
- employee-requests-repository.test.ts: import RowDataPacket, replace 'const [users]: any' with 'const [users] = await db.query<RowDataPacket[]>'
- Change '@typescript-eslint/no-explicit-any' from 'warn' to 'error' in eslint.config.js
- Remove outdated comment about 341 existing uses (now 0)
- All code is now free of explicit any types
- Remove the "55 uses of any left in the backend" entry.

Why: auth, config, cron, scripts and tests are typed and no-explicit-any
is an error again; the backend lint reports 0 problems.
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
four-points Ready Ready Preview Oct 12, 2026 7:43am UTC

@bpstack
bpstack merged commit f733894 into claude/compassionate-planck-gh6aof Oct 12, 2026
6 checks passed
@bpstack
bpstack deleted the opencode/any branch October 12, 2026 19:01

This branch was successfully deployed

1 active deployment
Preview — fef59425 Deployed Oct 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant