[TypeScript] AggregationBindingInfo#groupHeaderFactory incorrectly restricts group keys to string
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
Research direction
Start with the AggregationBindingInfo typedef in src/sap.ui.core/src/sap/ui/base/ManagedObject.js, which the issue links, and inspect how its groupHeaderFactory key type reaches types/sap.ui.core.d.ts. Check the Sorter documentation cited in the report for the supported primitive group values. Done when the generated declaration accepts string, boolean, and number keys without rejecting valid grouping callbacks.
Written by the indexing model from the issue text.
Description
What is the issue and how can we reproduce it?
Title
Incorrect groupHeaderFactory parameter type: group keys are not limited to strings
Description
In @sapui5/types version 1.153.0, AggregationBindingInfo.groupHeaderFactory is declared as:
groupHeaderFactory?: (p1: { key: string }) => ManagedObject;
The key type is too restrictive. When grouping an OData list by an entity property, the group key depends on the property's runtime type. It can also be a boolean or number, for example when grouping by an Edm.Boolean or Edm.Int32 property.
The sap.ui.model.Sorter documentation explicitly states that grouping can use the raw model property value and that primitive group values are passed to groupHeaderFactory as the key property.
Steps To Reproduce
Bind a list to an OData entity set containing a Boolean property named IsActive, and enable grouping on that property:
import GroupHeaderListItem from "sap/m/GroupHeaderListItem";
import Sorter from "sap/ui/model/Sorter";
list.bindItems({
path: "/Entities",
template: itemTemplate,
sorter: new Sorter("IsActive", false, true),
groupHeaderFactory: group => new GroupHeaderListItem({
title: group.key === true ? "Active" : "Inactive"
})
});
TypeScript reports that comparing string and boolean is invalid, although group.key can be a Boolean at runtime. Grouping by a numeric property causes the equivalent type mismatch.
Expected Behaviour
The callback parameter should allow non-string group keys. At minimum:
groupHeaderFactory?: (
p1: { key: string | boolean | number }
) => ManagedObject;
Actual Behaviour
The generated definition restricts key to string, requiring unnecessary type workarounds for valid grouping scenarios.
Environment
- Package:
@sapui5/types - Version:
1.153.0 - Declaration file:
types/sap.ui.core.d.ts - API:
sap.ui.base.AggregationBindingInfo.groupHeaderFactory - JSDoc typedef
AggregationBindingInfo: https://github.com/UI5/openui5/blob/1.153.0/src/sap.ui.core/src/sap/ui/base/ManagedObject.js#L3727
Which OpenUI5 version is your project targeting?
1.153.0
Is the issue device- or browser-specific?
No response
Confirmation
- I have searched the existing issues and reviewed the relevant documentation as well as the API reference.
- I am not disclosing any internal or sensitive information.
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from UI5/openui5
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
sap.m.Menu itemSelected event parameter item is typed too broadlyMay be free again @didip1000 claimed this 64 days ago, and no pull request is open. Openbug documentation in progress
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
CodeEditor - manually closing a tag causes crashPossibly taken @olannyv claimed this 29 days ago. Openbug in progress
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug in progress
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
bug in progress
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
laaielichter/AgentHaven#294 ·
Maintainers usually reply within 1 day
-
documentation P3 tests
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
cafebugado/backendeventos-public-api#128 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/OpenSearch-Dashboards#13289 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
erkamyaman/rea-games#246 ·
Maintainers usually reply within 1 day