@mixxtor/currencyx-js
Version:
Modern TypeScript currency converter with type inference and multiple providers (Google Finance, Fixer.io). Framework agnostic with clean architecture.
23 lines (21 loc) • 640 B
text/typescript
import type { BaseCurrencyExchange } from '../exchanges/base_exchange.js'
import type { CurrencyConfig } from '../types/index.js'
/**
* Helper function to define currency configuration with type inference
*
* @example
* ```typescript
* const config = defineConfig({
* default: 'google' as const,
* exchanges: {
* google: exchanges.google({ base: 'USD' }),
* fixer: exchanges.fixer({ accessKey: 'your-key' })
* }
* })
* ```
*/
export function defineConfig<KnownExchanges extends Record<string, BaseCurrencyExchange>>(
config: CurrencyConfig<KnownExchanges>
): CurrencyConfig<KnownExchanges> {
return config
}