Skip to content

Commit 3aee3e8

Browse files
committed
Revert "Tweaking types and removing any usage"
This reverts commit a3d0dd0.
1 parent 80dcac5 commit 3aee3e8

File tree

2 files changed

+42
-70
lines changed

2 files changed

+42
-70
lines changed

types/constants.d.ts

+18-15
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,23 @@ export const SI_KBYTE: "kB";
1919
export const SPACE: " ";
2020
export const STRING: "string";
2121
export const ZERO: "0";
22-
23-
export const STRINGS: {
24-
symbol: {
25-
iec: {
26-
bits: string[],
27-
bytes: string[]
28-
},
29-
jedec: {
30-
bits: string[],
31-
bytes: string[],
22+
export namespace STRINGS {
23+
namespace symbol {
24+
namespace iec {
25+
const bits: string[];
26+
const bytes: string[];
3227
}
33-
},
34-
fullform: {
35-
iec: string[],
36-
jedec: string[]
28+
namespace jedec {
29+
const bits_1: string[];
30+
export { bits_1 as bits };
31+
const bytes_1: string[];
32+
export { bytes_1 as bytes };
33+
}
34+
}
35+
namespace fullform {
36+
const iec_1: string[];
37+
export { iec_1 as iec };
38+
const jedec_1: string[];
39+
export { jedec_1 as jedec };
3740
}
38-
}
41+
}

types/filesize.d.ts

+24-55
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,32 @@
1-
interface FileSizeOptionsBase {
2-
base?: number;
1+
export interface FileSizeOptions {
32
bits?: boolean;
4-
exponent?: number;
5-
fullform?: boolean;
6-
fullforms?: string[];
7-
locale?: string | boolean;
8-
localeOptions?: Intl.DateTimeFormatOptions;
93
pad?: boolean;
10-
precision?: number;
4+
base?: number;
115
round?: number;
12-
roundingMethod?: 'round' | 'floor' | 'ceil';
6+
locale?: string;
7+
localeOptions?: {};
138
separator?: string;
149
spacer?: string;
10+
symbols?: {};
1511
standard?: 'iec' | 'jedec';
16-
symbols?: {
17-
iec: {
18-
bits: string[],
19-
bytes: string[]
20-
},
21-
jedec: {
22-
bits: string[],
23-
bytes: string[]
24-
}
25-
};
26-
}
27-
28-
interface FileSizeOptionsArray extends FileSizeOptionsBase {
29-
output: 'array'
30-
}
31-
32-
interface FileSizeOptionsExponent extends FileSizeOptionsBase {
33-
output: 'exponent'
34-
}
35-
36-
interface FileSizeOptionsObject extends FileSizeOptionsBase {
37-
output: 'object'
38-
}
39-
40-
interface FileSizeOptionsString extends FileSizeOptionsBase {
41-
output: 'string'
42-
}
43-
44-
interface FileSizeReturnObject {
45-
value: string,
46-
symbol: string,
47-
exponent: number,
48-
unit: string,
12+
output?: 'array' | 'exponent' | 'object' | 'string';
13+
fullform?: boolean;
14+
fullforms?: any[];
15+
exponent?: number;
16+
roundingMethod?: 'round' | 'floor' | 'ceil';
17+
precision?: number;
4918
}
5019

51-
type FileSizeReturnArray = [ number, string ]
52-
53-
export function filesize(byteCount: number, options: FileSizeOptionsString): string
54-
export function filesize(byteCount: number, options: FileSizeOptionsArray): FileSizeReturnArray
55-
export function filesize(byteCount: number, options: FileSizeOptionsExponent): number
56-
export function filesize(byteCount: number, options: FileSizeOptionsObject): FileSizeReturnObject
57-
export function filesize(byteCount: number): string
58-
59-
export function partial(options: FileSizeOptionsString): (byteCount: number) => string
60-
export function partial(options: FileSizeOptionsArray): (byteCount: number) => FileSizeReturnArray
61-
export function partial(options: FileSizeOptionsExponent): (byteCount: number) => number
62-
export function partial(options: FileSizeOptionsObject): (byteCount: number) => FileSizeReturnObject
63-
export function partial(): (byteCount: number) => string
20+
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[] | {
21+
value: any;
22+
symbol: any;
23+
exponent: number;
24+
unit: string;
25+
};
26+
27+
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[] | {
28+
value: any;
29+
symbol: any;
30+
exponent: number;
31+
unit: string;
32+
};

0 commit comments

Comments
 (0)