fix(backend): remove any usages from public.ts to improve type safety#588
fix(backend): remove any usages from public.ts to improve type safety#588Satvik-art-creator wants to merge 1 commit into
Conversation
|
@Satvik-art-creator is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for opening this pull request. This PR has been automatically classified based on the files modified. Applied Labels
Primary Review Area
Reviewer@Harxhit has been identified as the primary reviewer for this pull request. If you have any questions regarding the affected area or implementation details, feel free to reach out to the assigned reviewer. Thank you for your contribution! |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR tightens TypeScript typing in the public routes by removing any casts and introducing more explicit types for request query params and card link mappings.
Changes:
- Replaced
(request.query as any)access with typedrequest.query.format/request.query.size. - Replaced
anyincard.cardLinks.map(...)with a typed object shape forplatformLink.
Files not reviewed (1)
- apps/backend/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| accentColor: card.user.accentColor, | ||
| }, | ||
| links: card.cardLinks.map((cl: any) => ({ | ||
| links: card.cardLinks.map((cl: { platformLink: { id: string; platform: string; username: string; url: string } }) => ({ |
CI — All Checks PassedBackend — PASS
Mobile — SKIP
Web — SKIP
Last updated: |
|
@Harxhit Kindly review my pr. Let me know if everything is fine |
Summary
This PR improves type safety in the public routes by removing the remaining usages of
anyinapps/backend/src/routes/public.ts. This ensures strict type-checking on query parameters and mapping functions, making future refactoring safer and more predictable.This issue is solved under GSSoC '26.
Closes #553
Type of Change
What Changed
apps/backend/src/routes/public.ts: Replaced the(cl: any)cast in thegetCardByIdresponse mapping with an explicit structural type ({ platformLink: { id: string; platform: string; username: string; url: string } }) to maintain strict typing without IDE export errors.apps/backend/src/routes/public.ts: Replaced(request.query as any).formatand(request.query as any).sizewith properly typedrequest.query.formatandrequest.query.size, natively inheriting from the route'sQuerystringschema definition.How to Test
git checkout fix/public-ts-typescd apps/backend && npm installanyerrors:npm run typecheckChecklist
pnpm -r run lintpasses).pnpm -r run typecheck).pnpm -r run test).console.logor debug statements left in the code.Additional Context
Used structural inline typing for the mapped
platformLinkvariable to avoid editor/IDE linting complaints related to cached Prisma generated type exports.