Skip to content

Improve Type Safety in public.ts and Remove Remaining any Usage #553

@Harxhit

Description

@Harxhit

Summary

Improve type safety in public.ts by removing remaining usages of any and replacing them with proper Fastify, TypeScript, and application-specific types.

Contexts

The public routes currently contain several usages of any that bypass TypeScript's type checking and reduce maintainability.

Examples include:

(cl: any)
(request.query as any).format
(request.query as any).size

Some of these usages are related to query parameter handling, response mapping, and route typing. Existing Fastify and application-specific types should be reused where available instead of introducing duplicate definitions.

Removing these usages will improve maintainability, reduce unsafe casts, and make future refactoring easier.

Tasks

  • Identify all remaining any usages in public.ts
  • Replace (request.query as any) with properly typed query parameters
  • Replace callback parameter typings such as (cl: any) with appropriate types
  • Reuse existing Fastify and application-specific types where available
  • Improve route and response typing where applicable
  • Verify TypeScript passes without introducing new type errors
  • Update tests if required

Acceptance Criteria

  • No any usages remain in public.ts
  • Query parameters are properly typed
  • Response mapping uses appropriate TypeScript types
  • Existing shared types are reused where applicable
  • TypeScript checks pass successfully
  • Existing public route functionality continues to work
  • Tests pass successfully

Area

backend

Difficulty

Good First Issue

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions