avoidwork / filesize.js

JavaScript library to generate a human readable String describing the file size
https://filesizejs.com
BSD 3-Clause "New" or "Revised" License
1.61k stars 97 forks source link

Inferring output type based on `output` option #169

Closed 4ntke closed 1 year ago

4ntke commented 1 year ago

I suggest improving the return type inference. The main function returns a union of type but the return type can be narrowed to the type specified by the value of the output option. By default, a string value is returned, because the default value of the output option is string. Narrowing the return type based on output option would be great.

avoidwork commented 1 year ago

@4ntke open a pull request if you'd like to see a potential change.