UNPKG

@mixxtor/currencyx-js

Version:

Modern TypeScript currency converter with type inference and multiple providers (Google Finance, Fixer.io). Framework agnostic with clean architecture.

27 lines (24 loc) 747 B
/** * Configuration Helper * * Provides type-safe configuration definition similar to @adonisjs/drive */ 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 }