diff --git a/attw.json b/attw.json index 8dd96f3c901511..a3518f95e212bf 100644 --- a/attw.json +++ b/attw.json @@ -148,7 +148,6 @@ "input-moment", "inputmask", "intl-unofficial-duration-unit-format", - "ioredis-mock", "iput", "itemsjs", "itowns", diff --git a/notNeededPackages.json b/notNeededPackages.json index a79688965f0e5d..c696bff3602577 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -1669,6 +1669,10 @@ "libraryName": "diff2html", "asOfVersion": "3.0.0" }, + "dinero.js": { + "libraryName": "dinero.js", + "asOfVersion": "2.0.0" + }, "direction": { "libraryName": "direction", "asOfVersion": "2.0.0" diff --git a/types/dinero.js/.npmignore b/types/dinero.js/.npmignore deleted file mode 100644 index 93e307400a5456..00000000000000 --- a/types/dinero.js/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/dinero.js/dinero.js-tests.ts b/types/dinero.js/dinero.js-tests.ts deleted file mode 100644 index 776acd6d9dd067..00000000000000 --- a/types/dinero.js/dinero.js-tests.ts +++ /dev/null @@ -1,105 +0,0 @@ -import Dinero = require("dinero.js"); - -// Defaults -Dinero.defaultAmount = 100; -Dinero.defaultCurrency = "USD"; -Dinero.defaultPrecision = 2; -// Globals -Dinero.globalLocale = "en-US"; -Dinero.globalFormat = "0,0 dollar"; -Dinero.globalRoundingMode = "HALF_UP"; -Dinero.globalFormatRoundingMode = "0,0 dollar"; -Dinero.globalExchangeRatesApi = { - endpoint: "https://yourexchangerates.api/latest?base={{from}}", - propertyPath: "data.rates.{{to}}", - headers: { - "user-key": "xxxxxxxxx", - }, -}; -Dinero.globalExchangeRatesApi = { - endpoint: "https://yourexchangerates.api/latest?base={{from}}", - propertyPath: "data.rates.{{to}}", - roundingMode: "HALF_UP", -}; -Dinero.globalExchangeRatesApi = { - endpoint: new Promise((resolve) => - resolve({ - data: { - rates: { - USD: 1.337, - }, - }, - }) - ), - propertyPath: "data.rates.{{to}}", - roundingMode: "HALF_UP", -}; - -Dinero(); -Dinero({ amount: 1 }); -Dinero({ currency: "USD" }); -Dinero({ precision: 2 }); - -let number: number; -let string: string; -let boolean: boolean; - -let dinero: Dinero.Dinero = Dinero(); -let dineroArr: Dinero.Dinero[]; -let dineroObject: Dinero.DineroObject; - -number = dinero.getAmount(); -string = dinero.getCurrency(); -string = dinero.setLocale("fr-FR").getLocale(); -number = dinero.convertPrecision(4).getPrecision(); -number = dinero.convertPrecision(4, "HALF_DOWN").getPrecision(); -dinero = dinero.add(Dinero({ amount: 104545, precision: 4 })); -dinero = dinero.subtract(Dinero({ amount: 104545, precision: 4 })); -dinero = dinero.multiply(2.00125); -dinero = dinero.multiply(2.00125, "HALF_UP"); -dinero = dinero.divide(2); -dinero = dinero.divide(2, "HALF_UP"); -dinero = dinero.percentage(50); -dinero = dinero.percentage(50, "HALF_UP"); -dineroArr = dinero.allocate([50, 50]); -dinero.convert("EUR").then(d => (dinero = d)); -dinero.convert("XBT", { - endpoint: "https://yourexchangerates.api/latest?base={{from}}", - propertyPath: "data.rates.{{to}}", - headers: { - "user-key": "xxxxxxxxx", - }, - roundingMode: "HALF_UP", -}); -boolean = dinero.equalsTo(Dinero({ amount: 500, currency: "EUR" })); -boolean = dinero.lessThan(Dinero({ amount: 800 })); -boolean = dinero.lessThanOrEqual(Dinero({ amount: 800 })); -boolean = dinero.greaterThan(Dinero({ amount: 800 })); -boolean = dinero.greaterThanOrEqual(Dinero({ amount: 800 })); -boolean = dinero.isZero(); -boolean = dinero.isPositive(); -boolean = dinero.isNegative(); -boolean = dinero.hasSubUnits(); -boolean = dinero.hasCents(); -boolean = dinero.hasSameCurrency(Dinero({ amount: 1000, currency: "EUR" })); -boolean = dinero.hasSameAmount(Dinero({ amount: 1000, currency: "EUR" })); -string = dinero.toFormat("0,0 dollar"); -string = dinero.toFormat("0,0 dollar", "HALF_EVEN"); -number = dinero.toUnit(); -number = dinero.toRoundedUnit(1); -number = dinero.toRoundedUnit(1, "HALF_EVEN"); -number = dinero.toRoundedUnit(1, "DOWN"); -dineroObject = dinero.toObject(); -dineroObject = dinero.toJSON(); -dineroArr = Dinero.normalizePrecision([ - Dinero({ amount: 100, precision: 2 }), - Dinero({ amount: 1000, precision: 3 }), -]); -dinero = Dinero.minimum([ - Dinero({ amount: 100 }), - Dinero({ amount: 1000 }), -]); -dinero = Dinero.maximum([ - Dinero({ amount: 100 }), - Dinero({ amount: 1000 }), -]); diff --git a/types/dinero.js/index.d.ts b/types/dinero.js/index.d.ts deleted file mode 100644 index af0c060b82f876..00000000000000 --- a/types/dinero.js/index.d.ts +++ /dev/null @@ -1,269 +0,0 @@ -export as namespace Dinero; - -export = DineroFactory; - -declare function DineroFactory(options?: Dinero.Options): DineroFactory.Dinero; - -declare namespace DineroFactory { - let defaultAmount: number; - let defaultCurrency: Currency; - let defaultPrecision: number; - let globalLocale: string; - let globalFormat: string; - let globalRoundingMode: RoundingMode; - let globalFormatRoundingMode: string; - let globalExchangeRatesApi: ExchangeRatesApiOptions; - function normalizePrecision(objects: readonly Dinero[]): Dinero[]; - function minimum(objects: readonly Dinero[]): Dinero; - function maximum(objects: readonly Dinero[]): Dinero; - - interface Options { - amount?: number | undefined; - currency?: Currency | undefined; - precision?: number | undefined; - } - - interface Dinero { - getAmount(): number; - getCurrency(): Currency; - getLocale(): string; - setLocale(newLocale: string): Dinero; - getPrecision(): number; - convertPrecision(newPrecision: number, roundingMode?: RoundingMode): Dinero; - add(addend: Dinero): Dinero; - subtract(subtrahend: Dinero): Dinero; - multiply(multiplier: number, roundingMode?: RoundingMode): Dinero; - divide(divisor: number, roundingMode?: RoundingMode): Dinero; - percentage(percentage: number, roundingMode?: RoundingMode): Dinero; - allocate(ratios: readonly number[]): Dinero[]; - convert(currency: string, options?: ExchangeRatesApiOptions): Promise; - equalsTo(comparator: Dinero): boolean; - lessThan(comparator: Dinero): boolean; - lessThanOrEqual(comparator: Dinero): boolean; - greaterThan(comparator: Dinero): boolean; - greaterThanOrEqual(comparator: Dinero): boolean; - isZero(): boolean; - isPositive(): boolean; - isNegative(): boolean; - hasSubUnits(): boolean; - /** - * @deprecated since version 2.0 - */ - hasCents(): boolean; - hasSameCurrency(comparator: Dinero): boolean; - hasSameAmount(comparator: Dinero): boolean; - toFormat(format?: string, roundingMode?: RoundingMode): string; - toUnit(): number; - toRoundedUnit(digits: number, roundingMode?: RoundingMode): number; - toObject(): DineroObject; - toJSON(): DineroObject; - } - - type RoundingMode = - | "HALF_ODD" - | "HALF_EVEN" - | "HALF_UP" - | "HALF_DOWN" - | "HALF_TOWARDS_ZERO" - | "HALF_AWAY_FROM_ZERO" - | "DOWN"; - - interface ExchangeRatesApiOptions { - endpoint: string | Promise<{ [key: string]: any }>; - propertyPath?: string | undefined; - headers?: { [header: string]: string } | undefined; - roundingMode?: RoundingMode | undefined; - } - - interface DineroObject { - amount: number; - currency: Currency; - precision: number; - } - - /** - * ISO 4217 CURRENCY CODES as specified in the documentation - * Taken from https://www.iso.org/iso-4217-currency-codes.html - * sorted and parsed - */ - type Currency = - | "AED" - | "AFN" - | "ALL" - | "AMD" - | "ANG" - | "AOA" - | "ARS" - | "AUD" - | "AWG" - | "AZN" - | "BAM" - | "BBD" - | "BDT" - | "BGN" - | "BHD" - | "BIF" - | "BMD" - | "BND" - | "BOB" - | "BOV" - | "BRL" - | "BSD" - | "BTN" - | "BWP" - | "BYN" - | "BZD" - | "CAD" - | "CDF" - | "CHE" - | "CHF" - | "CHW" - | "CLF" - | "CLP" - | "CNY" - | "COP" - | "COU" - | "CRC" - | "CUC" - | "CUP" - | "CVE" - | "CZK" - | "DJF" - | "DKK" - | "DOP" - | "DZD" - | "EGP" - | "ERN" - | "ETB" - | "EUR" - | "FJD" - | "FKP" - | "GBP" - | "GEL" - | "GHS" - | "GIP" - | "GMD" - | "GNF" - | "GTQ" - | "GYD" - | "HKD" - | "HNL" - | "HRK" - | "HTG" - | "HUF" - | "IDR" - | "ILS" - | "INR" - | "IQD" - | "IRR" - | "ISK" - | "JMD" - | "JOD" - | "JPY" - | "KES" - | "KGS" - | "KHR" - | "KMF" - | "KPW" - | "KRW" - | "KWD" - | "KYD" - | "KZT" - | "LAK" - | "LBP" - | "LKR" - | "LRD" - | "LSL" - | "LYD" - | "MAD" - | "MDL" - | "MGA" - | "MKD" - | "MMK" - | "MNT" - | "MOP" - | "MRU" - | "MUR" - | "MVR" - | "MWK" - | "MXN" - | "MXV" - | "MYR" - | "MZN" - | "NAD" - | "NGN" - | "NIO" - | "NOK" - | "NPR" - | "NZD" - | "OMR" - | "PAB" - | "PEN" - | "PGK" - | "PHP" - | "PKR" - | "PLN" - | "PYG" - | "QAR" - | "RON" - | "RSD" - | "RUB" - | "RWF" - | "SAR" - | "SBD" - | "SCR" - | "SDG" - | "SEK" - | "SGD" - | "SHP" - | "SLL" - | "SOS" - | "SRD" - | "SSP" - | "STN" - | "SVC" - | "SYP" - | "SZL" - | "THB" - | "TJS" - | "TMT" - | "TND" - | "TOP" - | "TRY" - | "TTD" - | "TWD" - | "TZS" - | "UAH" - | "UGX" - | "USD" - | "USN" - | "UYI" - | "UYU" - | "UYW" - | "UZS" - | "VES" - | "VND" - | "VUV" - | "WST" - | "XAF" - | "XAG" - | "XAU" - | "XBA" - | "XBB" - | "XBC" - | "XBD" - | "XCD" - | "XDR" - | "XOF" - | "XPD" - | "XPF" - | "XPT" - | "XSU" - | "XTS" - | "XUA" - | "XXX" - | "YER" - | "ZAR" - | "ZMW" - | "ZWL"; -} diff --git a/types/dinero.js/package.json b/types/dinero.js/package.json deleted file mode 100644 index aee5f104a5149c..00000000000000 --- a/types/dinero.js/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "private": true, - "name": "@types/dinero.js", - "version": "1.9.9999", - "projects": [ - "https://sarahdayan.github.io/dinero.js" - ], - "devDependencies": { - "@types/dinero.js": "workspace:." - }, - "owners": [ - { - "name": "BendingBender", - "githubUsername": "BendingBender" - }, - { - "name": "David Acosta", - "githubUsername": "juandaco" - }, - { - "name": "Piotr Błażejewicz", - "githubUsername": "peterblazejewicz" - } - ] -} diff --git a/types/dinero.js/tsconfig.json b/types/dinero.js/tsconfig.json deleted file mode 100644 index ca6ab5045e70df..00000000000000 --- a/types/dinero.js/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "node16", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "dinero.js-tests.ts" - ] -} diff --git a/types/ioredis-mock/index.d.ts b/types/ioredis-mock/index.d.ts index 8b3ce061968ea2..355517c8c5c35a 100644 --- a/types/ioredis-mock/index.d.ts +++ b/types/ioredis-mock/index.d.ts @@ -1,29 +1,31 @@ import ioredis = require("ioredis"); -export type RedisOptions = { data?: Record } & ioredis.RedisOptions; +declare namespace redisMock { + type RedisOptions = { data?: Record } & ioredis.RedisOptions; -export type RedisClusterOptions = { - redisOptions: Omit< - RedisOptions, - "port" | "host" | "path" | "sentinels" | "retryStrategy" | "enableOfflineQueue" | "readOnly" - >; -} & ioredis.ClusterOptions; + type RedisClusterOptions = { + redisOptions: Omit< + RedisOptions, + "port" | "host" | "path" | "sentinels" | "retryStrategy" | "enableOfflineQueue" | "readOnly" + >; + } & ioredis.ClusterOptions; -export interface ClusterConstructor { - new(startupNodes: ioredis.ClusterNode[], options?: RedisClusterOptions): ioredis.Cluster; -} + interface ClusterConstructor { + new(startupNodes: ioredis.ClusterNode[], options?: RedisClusterOptions): ioredis.Cluster; + } -export interface Constructor { - new(port: number, host: string, options: RedisOptions): ioredis.Redis; - new(path: string, options: RedisOptions): ioredis.Redis; - new(port: number, options: RedisOptions): ioredis.Redis; - new(port: number, host: string): ioredis.Redis; - new(options: RedisOptions): ioredis.Redis; - new(port: number): ioredis.Redis; - new(path: string): ioredis.Redis; - new(): ioredis.Redis; - Cluster: ClusterConstructor; + interface Constructor { + new(port: number, host: string, options: RedisOptions): ioredis.Redis; + new(path: string, options: RedisOptions): ioredis.Redis; + new(port: number, options: RedisOptions): ioredis.Redis; + new(port: number, host: string): ioredis.Redis; + new(options: RedisOptions): ioredis.Redis; + new(port: number): ioredis.Redis; + new(path: string): ioredis.Redis; + new(): ioredis.Redis; + Cluster: ClusterConstructor; + } } -export const redisMock: Constructor; -export { redisMock as default }; +declare const redisMock: redisMock.Constructor; +export = redisMock; diff --git a/types/ioredis-mock/ioredis-mock-tests.ts b/types/ioredis-mock/ioredis-mock-tests.ts index 04620ad8bc77cb..1cae4874ec4b87 100644 --- a/types/ioredis-mock/ioredis-mock-tests.ts +++ b/types/ioredis-mock/ioredis-mock-tests.ts @@ -1,4 +1,4 @@ -import IORedis, { RedisOptions } from "ioredis-mock"; +import IORedis = require("ioredis-mock"); // see https://www.npmjs.com/package/ioredis-mock for MockRedisInput input // see https://github.com/luin/ioredis/tree/master/examples @@ -61,7 +61,7 @@ redis.hgetall("myhash").then(res => console.log(res)); // All arguments are passed directly to the redis server: redis.set("key", 100, "EX", 10); // set's key to value 100 and expires it after 10 seconds -const options: RedisOptions = {}; +const options: IORedis.RedisOptions = {}; console.log(options.port); const f = async () => {