Risk Level
HIGH
File
core/src/exchanges/interfaces.ts
Findings
- Line 12:
callApi(operationId: string, params?: Record<string, any>): Promise<any> — the core exchange interface declares callApi with completely untyped params and return; every exchange implementation inherits this untyped contract
Impact
- As the root interface for all exchange adapters, this
any propagates to every class implementing the interface — both in core/src and in the SDK layer
- Callers coding against the
IExchange interface (rather than a concrete class) have no type information about callApi responses
- Fixing this interface is a prerequisite for properly typing
callApi in BaseExchange.ts and client.ts
Suggested Fix
- Make
callApi generic: callApi<T = unknown>(operationId: string, params?: Record<string, unknown>): Promise<T>
- Replace
Record<string, any> params with Record<string, unknown> — callers that need to pass typed params can still do so; it just requires explicit narrowing on the receiving end
Found by automated any type audit
Risk Level
HIGH
File
core/src/exchanges/interfaces.tsFindings
callApi(operationId: string, params?: Record<string, any>): Promise<any>— the core exchange interface declarescallApiwith completely untyped params and return; every exchange implementation inherits this untyped contractImpact
anypropagates to every class implementing the interface — both incore/srcand in the SDK layerIExchangeinterface (rather than a concrete class) have no type information aboutcallApiresponsescallApiinBaseExchange.tsandclient.tsSuggested Fix
callApigeneric:callApi<T = unknown>(operationId: string, params?: Record<string, unknown>): Promise<T>Record<string, any>params withRecord<string, unknown>— callers that need to pass typed params can still do so; it just requires explicit narrowing on the receiving endFound by automated any type audit