[TypeScript] Return type reported to be incorrect when changing output type from the default
alpha-tango-kilo opened this issue · 4 comments
alpha-tango-kilo commented
Using TypeScript, I'm told that the following will return a string, which isn't correct:
fileSize(123123, { output: "object" });
What I expect to be able to do:
let { value, symbol, exponent } = fileSize(123123, { output: "object" });
Current workaround:
let { value, symbol, exponent } = fileSize(123123], { output: "object" }) as unknown as { value: number, symbol: string, exponent: number };
For clarity, it is actually an object that gets returned, just the type declarations are telling me I'm going to get a string
alpha-tango-kilo commented
Upon further usage, it seems the same seems to apply for all the different output options - they all say they're going to return string
avoidwork commented
File was lifted from https://github.com/DefinitelyTyped/DefinitelyTyped; I didn't write it. Feel free to open a PR with fix or updated from that repo.
bhavya32 commented
@avoidwork do you know even whatsapp web uses your code?