From 2da3aaf22a16b6014cac6be0f7f06427ef209a0f Mon Sep 17 00:00:00 2001 From: "chris.aitken" Date: Fri, 21 Jul 2023 11:00:28 +0100 Subject: [PATCH] fixup: Add interface for filesize options object Will allow casting to the options shape --- types/filesize.d.ts | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/types/filesize.d.ts b/types/filesize.d.ts index 03ad3dd..bb57247 100644 --- a/types/filesize.d.ts +++ b/types/filesize.d.ts @@ -1,4 +1,4 @@ -export function filesize(arg: any, { bits, pad, base, round, locale, localeOptions, separator, spacer, symbols, standard, output, fullform, fullforms, exponent, roundingMethod, precision }?: { +export interface FileSizeOptions { bits?: boolean; pad?: boolean; base?: number; @@ -8,37 +8,23 @@ export function filesize(arg: any, { bits, pad, base, round, locale, localeOptio separator?: string; spacer?: string; symbols?: {}; - standard?: string; - output?: string; + standard?: 'iec' | 'jedec'; + output?: 'array' | 'exponent' | 'object' | 'string'; fullform?: boolean; fullforms?: any[]; exponent?: number; - roundingMethod?: string; + roundingMethod?: 'round' | 'floor' | 'ceil'; precision?: number; -}): string | number | any[] | { +} + +export function filesize(arg: any, { bits, pad, base, round, locale, localeOptions, separator, spacer, symbols, standard, output, fullform, fullforms, exponent, roundingMethod, precision }?: FileSizeOptions): string | number | any[] | { value: any; symbol: any; exponent: number; unit: string; }; -export function partial({ bits, pad, base, round, locale, localeOptions, separator, spacer, symbols, standard, output, fullform, fullforms, exponent, roundingMethod, precision }?: { - bits?: boolean; - pad?: boolean; - base?: number; - round?: number; - locale?: string; - localeOptions?: {}; - separator?: string; - spacer?: string; - symbols?: {}; - standard?: string; - output?: string; - fullform?: boolean; - fullforms?: any[]; - exponent?: number; - roundingMethod?: string; - precision?: number; -}): (arg: any) => string | number | any[] | { + +export function partial({ bits, pad, base, round, locale, localeOptions, separator, spacer, symbols, standard, output, fullform, fullforms, exponent, roundingMethod, precision }?: FileSizeOptions): (arg: any) => string | number | any[] | { value: any; symbol: any; exponent: number;