-
-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor: export useSlmApi internal interfaces to shared types #3196
Copy link
Copy link
Open
Description
Context
Discovered during implementation of #3167 (PR #3180). When replacing any types, consumers had to duplicate interface definitions instead of importing them.
Problem
useSlmApi.ts defines 57 interfaces inside the composable function scope. None are exported. This forces consumers to:
- Use
any/unknown(what Enhancement: replace remaining ~167 any types in Vue components and low-count TS files #3167 was fixing) - Duplicate interfaces locally (what PR fix(frontend): replace remaining any types in Vue/TS files (#3167) #3180 did for
MonitoringErrorinAdminMonitoringView.vue) - Use
ReturnTypetricks (what PR fix(frontend): replace remaining any types in Vue/TS files (#3167) #3180 did forLoginView.vue)
Example: AdminMonitoringView.vue had to define its own MonitoringError interface matching the shape of items in RecentErrorsResponse.errors, because RecentError is scoped inside useSlmApi().
Affected Interfaces (sample)
RecentError,RecentErrorsResponse— used by monitoring viewsFleetCert— used by security/certificate viewsSystemHealth,ErrorStats,MetricSummary— used by admin monitoring- All 10 security response types (see Enhancement: add typed response interfaces for security API endpoints #3184)
Solution
Move shared response interfaces to src/types/slm.ts (or a new src/types/api-responses.ts) and import them in both useSlmApi.ts and consumer components. This eliminates duplication and makes type-safe API consumption straightforward.
Discovered During
Reactions are currently unavailable