Skip to content

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

Merged
Harxhit merged 3 commits into
Dev-Card:mainfrom
yachikadev:fix/550-follow-ts-type-safety
Jun 15, 2026
Merged

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

Conversation

@yachikadev

Copy link
Copy Markdown
Contributor

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

@Harxhit Harxhit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Approving

@Harxhit Harxhit merged commit a2a220b into Dev-Card:main Jun 15, 2026
5 of 6 checks passed
@github-actions

Copy link
Copy Markdown

Congratulations @yachikadev on getting PR #575 merged!

Thank you for your contribution to the project.

To receive the appropriate GSSoC labels and recognition, please mention @Harxhit in the #get-labels channel on our Discord server and share your merged PR link.

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

2 participants