# @types/money

> TypeScript definitions for money

Latest version **0.2.3** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/money
pnpm add @types/money
yarn add @types/money
bun add @types/money
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2023-11-07 |
| First published | 2022-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51432 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/money
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/money
- npm.io page: https://npm.io/package/@types/money

## Recent versions

- 0.2.3 (latest) — 2023-11-07
- 0.2.0 (ts4.0) — 2022-07-27
- 0.2.2 — 2023-10-18
- 0.2.1 — 2023-09-27

## README

# Installation
> `npm install --save @types/money`

# Summary
This package contains type definitions for money (https://github.com/openexchangerates/money.js).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/money.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/money/index.d.ts)
````ts
declare namespace fx {
    type Currency = string;

    type Rates = Record<string, number | string>;

    interface Options {
        from?: Currency;
        to?: Currency;
    }

    type Value = string | number | string[] | number[];

    type Result<T_VAL extends Value> = T_VAL extends string | number ? number : number[];

    interface Wrapper<T_VAL extends Value> {
        convert: (opts?: Options) => Result<T_VAL>;

        from: (currency: Currency) => Wrapper<T_VAL>;

        to: (currency: Currency) => Result<T_VAL>;
    }

    interface FX {
        /**
         * If fx(val) is called as a function, it returns a wrapped object that can be used OO-style
         */
        <T_VAL extends Value>(val: T_VAL): Wrapper<T_VAL>;
        new<T_VAL extends Value>(val: T_VAL): Wrapper<T_VAL>;

        /**
         * Current version
         */
        version: string;

        /**
         * Object containing exchange rates relative to the fx.base currency, eg { "GBP" : "0.64" }
         */
        rates: Rates;

        /**
         * Default exchange rate base currency (eg "USD"), which all the exchange rates are relative to
         */
        base: Currency;

        /**
         * Default from / to currencies for conversion via `convert()`
         */
        settings: {
            from: Currency;
            to: Currency;
        };

        /**
         * Converts a value from one currency to another
         */
        convert: <T_VAL extends Value>(val: T_VAL, opts?: Options) => Result<T_VAL>;
    }
}

/**
 * Library for realtime currency conversion and exchange rate calculation
 */
declare const fx: fx.FX;

export as namespace fx;

export = fx;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: none

# Credits
These definitions were written by [Ivan Ergunov](https://github.com/hozblok).

---
_Source: https://npm.io/package/@types/money · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
