From ffb85ade9023c5c5fcbee634fcf4ac6ceb34122b Mon Sep 17 00:00:00 2001 From: R0m1k3 Date: Thu, 16 Apr 2026 10:58:11 +0200 Subject: [PATCH] fix: add @types/cors and fix jwt expiresIn type Co-Authored-By: Claude Haiku 4.5 --- backend/package.json | 1 + backend/src/utils/jwt.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index b6c4518..bbab82d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -29,6 +29,7 @@ "devDependencies": { "@types/express": "^4.17.20", "@types/node": "^20.8.0", + "@types/cors": "^2.8.17", "@types/jsonwebtoken": "^9.0.4", "@types/bcryptjs": "^2.4.2", "typescript": "^5.2.2", diff --git a/backend/src/utils/jwt.ts b/backend/src/utils/jwt.ts index ae8eff6..551da13 100644 --- a/backend/src/utils/jwt.ts +++ b/backend/src/utils/jwt.ts @@ -1,9 +1,11 @@ import jwt from 'jsonwebtoken'; import { IUser } from '../models/User'; +import type { SignOptions } from 'jsonwebtoken'; + const JWT_SECRET = process.env.JWT_SECRET || 'dev_secret_key'; -const JWT_EXPIRES_IN = process.env.JWT_EXPIRES_IN || '7d'; -const JWT_REFRESH_EXPIRES_IN = process.env.JWT_REFRESH_EXPIRES_IN || '30d'; +const JWT_EXPIRES_IN = (process.env.JWT_EXPIRES_IN || '7d') as SignOptions['expiresIn']; +const JWT_REFRESH_EXPIRES_IN = (process.env.JWT_REFRESH_EXPIRES_IN || '30d') as SignOptions['expiresIn']; export interface JwtPayload { id: string;