Skip to content

api.ts: re-exported Product and Policy types from api.ts create a confusing second source of truth #149

Description

@nonsobethel0-dev

Summary

src/lib/api.ts lines 7-8:

// Re-export for backward compat with existing imports
export type { Product, Policy };

These types are defined in src/types/index.ts and re-exported from api.ts. This creates two valid import paths for the same type:

import type { Product } from '@/types';       // canonical
import type { Product } from '@/lib/api';     // also works (re-export)

The comment says "backward compat" suggesting this was a migration shim that was never cleaned up. Mixing import paths means:

  • IDEs show two definitions when navigating to the type
  • The TypeScript project's type graph has an extra indirection
  • New contributors are uncertain which path to use
  • If api.ts is ever split, this shim must be remembered and moved

Acceptance criteria

  • All usages of import type { Product, Policy } from '@/lib/api' across the codebase are migrated to '@/types'
  • The re-export lines 7-8 in api.ts are removed
  • TypeScript compilation still passes after the migration

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions