Skip to content

Conversation

@Justintime50
Copy link
Member

@Justintime50 Justintime50 commented Feb 2, 2026

Summary

This PR addresses multiple critical issues with TypeScript definitions found during a comprehensive audit of the codebase.

NOTE: AI was used to generate these changes which would have been difficult to identify by hand.

Closes #438 (partially)
Closes #515

Fixes

Changes

Critical Issues Fixed

1. Duplicate Rate Definitions

  • Problem: Two separate IRate interfaces in types/Rate/Rate.d.ts and types/Shipment/Rate.d.ts
  • Fix: Consolidated into single canonical definition, removed duplicate
  • Files: Deleted types/Shipment/Rate.d.ts, updated types/Shipment/index.d.ts to re-export from ../Rate

2. Missing Exports

Added missing exports to types/index.d.ts:

  • Referral
  • Claim
  • CustomerPortal
  • Embeddable
  • SmartRate
  • Luma

3. Missing Service Definitions

Added missing services to EasyPost client (types/EasyPost.d.ts):

4. Missing Type Definitions

  • Luma: Created complete type definitions based on src/services/luma_service.js
    • types/Luma/Luma.d.ts
    • types/Luma/index.d.ts
  • SmartRate: Created missing types/SmartRate/index.d.ts
  • TaxIdentifier: Created types/Shipment/TaxIdentifier.d.ts for embedded tax identifier objects

High Priority Fixes

5. Interface/Class Property Mismatches

  • Pickup.instructions: Made class property optional nullable to match interface
  • Order: Fixed return_address, buyer_address, is_return to be optional nullable
  • User.reference: Added missing field to IUser interface

6. Typos and Inconsistencies

  • Options.d.ts: Fixed typo pickup_man_datetimepickup_max_datetime
  • ScanForm.d.ts: Standardized getNextPage() return type to use scan_forms
  • Referral.d.ts: Standardized getNextPage() return type to use referral_customers

Testing

  • ✅ Build successful: npm run build
  • ✅ All tests passing: 173 tests across 34 test files
  • ✅ All new type files created correctly
  • ✅ Duplicate files removed successfully

Files Changed

Modified (12):

  • types/EasyPost.d.ts
  • types/Order/Order.d.ts
  • types/Pickup/Pickup.d.ts
  • types/Referral/Referral.d.ts
  • types/ScanForm/ScanForm.d.ts
  • types/Shipment/Options/Options.d.ts
  • types/Shipment/Shipment.d.ts
  • types/Shipment/ShipmentCreateParameters.d.ts
  • types/Shipment/index.d.ts
  • types/User/User.d.ts
  • types/index.d.ts

Created (5):

  • types/Luma/Luma.d.ts
  • types/Luma/index.d.ts
  • types/SmartRate/index.d.ts
  • types/Shipment/TaxIdentifier.d.ts

Deleted (1):

  • types/Shipment/Rate.d.ts

🤖 Generated with Claude Code

This commit addresses multiple issues with TypeScript definitions:

## Critical Fixes
- Fix #515: Export ReferralCustomer property correctly
- Add missing api_keys field to Referral interface
- Consolidate duplicate Rate definitions (removed types/Shipment/Rate.d.ts)
- Add missing exports: Claim, CustomerPortal, Embeddable, Luma, Referral, SmartRate
- Add missing services to EasyPost client: Claim, CustomerPortal, Embeddable, Luma, SmartRate

## New Type Definitions
- Create Luma type definitions (types/Luma/)
- Create SmartRate index file
- Create TaxIdentifier type definition for Shipment

## Type Corrections
- Fix Pickup.instructions: now optional nullable
- Fix Order properties: return_address, buyer_address, is_return now optional nullable
- Add missing User.reference field
- Fix typo: pickup_man_datetime → pickup_max_datetime
- Standardize ScanForm.getNextPage() return type to use scan_forms
- Standardize Referral.getNextPage() return type to use referral_customers

## Files Modified (12)
- types/EasyPost.d.ts
- types/Order/Order.d.ts
- types/Pickup/Pickup.d.ts
- types/Referral/Referral.d.ts
- types/ScanForm/ScanForm.d.ts
- types/Shipment/Options/Options.d.ts
- types/Shipment/Shipment.d.ts
- types/Shipment/ShipmentCreateParameters.d.ts
- types/Shipment/index.d.ts
- types/User/User.d.ts
- types/index.d.ts

## Files Created (5)
- types/Luma/Luma.d.ts
- types/Luma/index.d.ts
- types/SmartRate/index.d.ts
- types/Shipment/TaxIdentifier.d.ts

## Files Deleted (1)
- types/Shipment/Rate.d.ts (duplicate)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@Justintime50 Justintime50 force-pushed the fix/typescript-definitions-audit branch from fa7e2e4 to 15f05e8 Compare February 2, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Type export issues with ReferralCustomer

2 participants