Skip to content

Improve Type Safety in nfc.ts and Remove Remaining any Usage #551

Description

@Harxhit

Summary

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

Contexts

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

Examples include:

const server = request.server as any;
(app as any).authenticate
(request.user as any).id

Some of these usages are related to authentication and Fastify route handlers. Existing shared Fastify/JWT type definitions 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 nfc.ts
  • Use existing Fastify/JWT type definitions where available
  • Replace server as any with appropriate Fastify types
  • Replace app as any with appropriate Fastify types
  • Replace request.user as any with properly typed user access
  • Improve authentication-related typing where applicable
  • Verify TypeScript passes without introducing new type errors
  • Update tests if required

Acceptance Criteria

  • No any usages remain in nfc.ts
  • Existing shared Fastify/JWT types are reused where applicable
  • Authenticated user access is properly typed
  • Authentication-related code uses proper Fastify types
  • TypeScript checks pass successfully
  • Existing NFC functionality continues to work
  • Tests pass successfully

Area

backend

Difficulty

Good First Issue

Metadata

Metadata

Assignees

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions