Skip to content

refactor(types): centralize API response types#500

Merged
mikewheeleer merged 2 commits into
StableRoute-Org:mainfrom
darius-daniel:refactor/types-move-the-api-response
Jul 23, 2026
Merged

refactor(types): centralize API response types#500
mikewheeleer merged 2 commits into
StableRoute-Org:mainfrom
darius-daniel:refactor/types-move-the-api-response

Conversation

@darius-daniel

Copy link
Copy Markdown
Contributor

Consolidate all API response type definitions into src/lib/types.ts
to prevent type drift and establish a single source of truth.

  • Create centralized types module with Pair, Quote, AppEvent, DisplayEvent,
    ApiKey, and Webhook types
  • Update all modules and components to import from centralized types
  • Add comprehensive test coverage (42 tests)
  • Update docs/api-client.md

Validation logic remains in respective modules (quote.ts, events.ts,
webhookEvents.ts) as domain owners.

Related Issue

Closes #351

….ts with centralized API response type definitions (Pair, Quote, AppEvent, DisplayEvent, ApiKey, CreateApiKeyResponse, Webhook) - Update modules to import/re-export from types.ts for consistency: * src/lib/quote.ts re-exports Quote * src/lib/events.ts re-exports AppEvent, DisplayEvent * src/lib/webhookEvents.ts re-exports Webhook * src/app/pairs/pairsUtils.ts imports Pair - Update all Client components to import types from types.ts: * src/app/api-keys/Client.tsx uses ApiKey and CreateApiKeyResponse * src/app/webhooks/Client.tsx uses Webhook * src/app/quote/Client.tsx uses Quote * src/app/pairs/Client.tsx uses Pair (via pairsUtils) - Add comprehensive test suite with 42 tests covering: * All type definitions and their properties * Type constraints and edge cases * Re-exports from utility modules * Type interoperability and nesting - Update docs/api-client.md with centralized types documentation This eliminates type drift between pages and provides a single source of truth for API response shapes. Validation logic remains in respective modules (quote.ts, events.ts, webhookEvents.ts). Test coverage: 42/42 tests passing Lint: ✓ No warnings or errors Build: ✓ Production build succeeds
@mikewheeleer

Copy link
Copy Markdown
Contributor

thanks @darius-daniel, this is exactly what #351 needed. merging 🎊

@mikewheeleer
mikewheeleer merged commit d0b1a9b into StableRoute-Org:main Jul 23, 2026
2 checks passed
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.

Move the API response types into a single shared types module

2 participants