Skip to content

Fixing type def regression #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/filesize.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const STRINGS = {

/**
* Converts a file size in bytes to a human-readable string with appropriate units
* @param {number|bigint} arg - The file size in bytes to convert
* @param {number|string|bigint} arg - The file size in bytes to convert
* @param {Object} [options={}] - Configuration options for formatting
* @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes
* @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter
Expand Down
2 changes: 1 addition & 1 deletion dist/filesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const STRINGS = {
}
};/**
* Converts a file size in bytes to a human-readable string with appropriate units
* @param {number|bigint} arg - The file size in bytes to convert
* @param {number|string|bigint} arg - The file size in bytes to convert
* @param {Object} [options={}] - Configuration options for formatting
* @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes
* @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter
Expand Down
2 changes: 1 addition & 1 deletion dist/filesize.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/filesize.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const STRINGS = {
}
};/**
* Converts a file size in bytes to a human-readable string with appropriate units
* @param {number|bigint} arg - The file size in bytes to convert
* @param {number|string|bigint} arg - The file size in bytes to convert
* @param {Object} [options={}] - Configuration options for formatting
* @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes
* @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter
Expand Down
2 changes: 1 addition & 1 deletion dist/filesize.umd.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/filesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {

/**
* Converts a file size in bytes to a human-readable string with appropriate units
* @param {number|bigint} arg - The file size in bytes to convert
* @param {number|string|bigint} arg - The file size in bytes to convert
* @param {Object} [options={}] - Configuration options for formatting
* @param {boolean} [options.bits=false] - If true, calculates bits instead of bytes
* @param {boolean} [options.pad=false] - If true, pads decimal places to match round parameter
Expand Down
6 changes: 3 additions & 3 deletions types/filesize.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type FilesizeArray = [number | string, string];
/**
* Return type based on output option
*/
export type FilesizeReturn<T extends FilesizeOptions = {}> =
export type FilesizeReturn<T extends FilesizeOptions = {}> =
T['output'] extends "object" ? FilesizeObject :
T['output'] extends "array" ? FilesizeArray :
T['output'] extends "exponent" ? number :
Expand All @@ -76,7 +76,7 @@ export type FilesizeReturn<T extends FilesizeOptions = {}> =
* filesize(1024, {output: "object"}) // {value: 1, symbol: "KB", exponent: 1, unit: "KB"}
*/
export function filesize<T extends FilesizeOptions = {}>(
arg: number | bigint,
arg: number | string | bigint,
options?: T
): FilesizeReturn<T>;

Expand All @@ -91,4 +91,4 @@ export function filesize<T extends FilesizeOptions = {}>(
*/
export function partial<T extends FilesizeOptions = {}>(
options?: T
): (arg: number | bigint) => FilesizeReturn<T>;
): (arg: number | string | bigint) => FilesizeReturn<T>;
Loading