-
Notifications
You must be signed in to change notification settings - Fork 0
Tech Story: Eliminate TypeScript any types across backend and frontend #100
Copy link
Copy link
Open
Labels
backendBackend services and logicBackend services and logicfrontendFrontend app and dashboardFrontend app and dashboardtech-storyTechnical implementation storyTechnical implementation story
Milestone
Description
Tech Story
As a platform engineer, I want all explicit and implicit any types replaced with proper TypeScript types so that the compiler can catch type errors at the boundaries where security-sensitive data flows (JWT payloads, request objects, auth guards).
Context
Audit found any types concentrated in auth-critical code paths:
auth.service.ts:validateUser(): Promise<any>,login(user: any)jwt.strategy.ts:validate(payload: any)auth.controller.ts:@Request() req: anyon refresh, logout, change-passwordorg-inventory.controller.ts:@Request() req: any,@Query() query: Record<string, any>base-uex.repository.ts: multipleas anycastsaudit-log.entity.ts/audit-logs.service.ts:Record<string, any>on metadata columnshttp-exception.filter.ts,audit-log.interceptor.ts: assortedanycasts
Acceptance Criteria
- A
JwtPayloadinterface defined and used inJwtStrategy.validate()andAuthService.login() - An
AuthenticatedRequestinterface (extending ExpressRequest) used in place ofreq: anyin all controllers -
OrgInventoryControllerquery params typed with a proper DTO class -
AuditLogmetadata columns typed asRecord<string, unknown> -
base-uex.repository.tsas anycasts replaced with typed generics or explicit interfaces -
pnpm typecheckpasses with zero errors - ESLint
@typescript-eslint/no-explicit-anyrule enabled and passing
Technical Elaboration
Add to auth/interfaces/:
jwt-payload.interface.ts:{ sub: number; username: string; iat?: number; exp?: number }authenticated-request.interface.ts: extends ExpressRequestwithuser: { userId: number; username: string }
Enable @typescript-eslint/no-explicit-any: 'error' in ESLint config once all instances resolved.
Notes
- Each file fixed should be a separate commit for easy review
- Some TypeORM/Passport internals may require
unknown+ narrowing rather than a direct type
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backendBackend services and logicBackend services and logicfrontendFrontend app and dashboardFrontend app and dashboardtech-storyTechnical implementation storyTechnical implementation story