Skip to content

[type-any] core/exchanges/interfaces.ts: 1 unsafe any in exchange interface #258

@realfishsam

Description

@realfishsam

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions