SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.94k stars 1.23k forks source link

Missing documentation for `decimals` in `sap.ui.core.format.FileSizeFormat` #3955

Open neoruien opened 7 months ago

neoruien commented 7 months ago

OpenUI5 version: 1.120.2

Browser/version (+device/version):

Any other tested browsers/devices(OK/FAIL):

URL (minimal example if possible):

User/password (if required and possible - do not post any confidential information here):

Steps to reproduce the problem:

What is the expected result?

What happens instead?

Any other information? (attach screenshot if possible)


For context, I am working on a UI5 project in typescript.

I want to format file size into 2 decimal places, so I referenced the online example: image

I typed FileSizeFormat.getInstance({ decimals: 2 }).format(1048576) into my code. But I got the error:

image

I have to suppress the Typescript warning by adding this line:

// @ts-expect-error decimals parameter is not documented in UI5 constructor

I know that decimals: 2 works, because without it, the file size gets formatted to 1.048576 MB. But when I include it, the file size is correctly formatted to 1.05 MB. This might be a simple missing documentation issue.

LidiyaGeorgieva commented 7 months ago

Hello @neoruien , Thank you for sharing this finding. I've created an internal incident DINC0049163. The status of the issue will be updated here in GitHub. Regards, Lidiya

SvBe commented 7 months ago

Hello, unfortunately it is a bigger topic to improve the JSDoc in the area of Formatters and Format options to properly support typescript. There is already a backlog item for this topic (CPOUI5MODELS-1111). Regards, Sven