fix: TypeScript type mismatch between UspsValidationResult and local fallback object #10

Merged
bermudalamb merged 1 commits from fix/usps-type-mismatch into main 2026-08-14 14:49:07 -05:00
Showing only changes of commit b73b472d80 - Show all commits
+3 -3
View File
@@ -1,7 +1,7 @@
import { Router, Request, Response } from 'express'; import { Router, Request, Response } from 'express';
import { pool } from '../db'; import { pool } from '../db';
import { requireCustomer } from '../middleware/customerAuth'; import { requireCustomer } from '../middleware/customerAuth';
import { validateAddress, uspsConfigured } from '../usps'; import { validateAddress, uspsConfigured, UspsValidationResult } from '../usps';
const router = Router(); const router = Router();
@@ -19,8 +19,8 @@ router.post('/', requireCustomer, async (req: Request, res: Response) => {
return res.status(400).json({ error: 'fullName, addressLine1, city, state, and postalCode are required' }); return res.status(400).json({ error: 'fullName, addressLine1, city, state, and postalCode are required' });
} }
let uspsResult = { validated: false, deliverable: null as boolean | null, standardized: null as Record<string, unknown> | null, reason: undefined as string | undefined }; let uspsResult: UspsValidationResult = { validated: false, deliverable: null, standardized: null };
if ((country || 'US') === 'US') { if ((country || 'US') === 'US') {
uspsResult = await validateAddress({ addressLine1, addressLine2, city, state, postalCode }); uspsResult = await validateAddress({ addressLine1, addressLine2, city, state, postalCode });
} }