UI5 / UI5/openui5

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

Open
#3,955 2 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

documentation enhancement in progress
Dominant language
JavaScript
Stars
3.3k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.