Skip to content

fix: improve type safety in follow.ts by removing any usages (#550)#575

Open
yachikadev wants to merge 3 commits into
Dev-Card:mainfrom
yachikadev:fix/550-follow-ts-type-safety
Open

fix: improve type safety in follow.ts by removing any usages (#550)#575
yachikadev wants to merge 3 commits into
Dev-Card:mainfrom
yachikadev:fix/550-follow-ts-type-safety

Conversation

@yachikadev

Copy link
Copy Markdown

Summary

Removes all remaining any usages from follow.ts and replaces them with proper Fastify and JWT types, reusing the existing type definitions in src/types/fastify.d.ts.

Changes

  • Removed request.server as any and (app as any).authenticate casts — FastifyInstance.authenticate and request.server are already properly typed via the existing fastify.d.ts augmentation, so no casts are needed.
  • Replaced (request as any).user = payload with request.user = payload, typing the JWT payload using request.jwtVerify<AuthenticatedUser>() (imported from ../types/fastify.js) so it matches the AuthenticatedUser type already declared for request.user.
  • Replaced all three (request.user as any).id usages with request.user.id.
  • Replaced catch (error: any) with catch (error) and used the existing getErrorMessage utility, matching the error-handling pattern already used elsewhere in this file.

Testing

  • npx tsc --noEmit passes with no errors.
  • Follow route tests: 16/16 passing.

Closes #550

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

@yachikadev 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.

@github-actions github-actions Bot added backend gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking. labels Jun 14, 2026
@github-actions

Copy link
Copy Markdown

Hi @yachikadev,

Thanks for opening this pull request.

This PR has been automatically classified based on the files modified.

Applied Labels

  • gssoc:approved
  • backend

Primary Review Area

  • backend

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!

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

CI — All Checks Passed

Backend — PASS

Check Result
Lint PASS
Test PASS
Typecheck PASS

Mobile — SKIP

Check Result
Lint -
Test -

Web — SKIP

Check Result
Check -
Build -

Last updated: Sun, 14 Jun 2026 12:48:10 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend gssoc:approved Required label for every approved PR. Gives the base +50 points and enables contribution tracking.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Type Safety in follow.ts and Remove Remaining any Usage

1 participant