[TypeScript] AggregationBindingInfo#groupHeaderFactory incorrectly restricts group keys to string
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, typescript
調査の方向性
issue がリンクしている src/sap.ui.core/src/sap/ui/base/ManagedObject.js の typedef AggregationBindingInfo から始め、キー groupHeaderFactory の型が types/sap.ui.core.d.ts にどのように伝わるかを調べてください。レポートで引用されている Sorter のドキュメントを確認し、サポートされるプリミティブなグループ値を調べてください。生成された宣言が string、boolean、number 型のキーを受け入れ、有効なグルーピングコールバックを拒否しなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- JavaScript
- スター
- 3.3k
- フォーク
- 1.3k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
UI5/openui5 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
sap.m.Menu itemSelected event parameter item is typed too broadly再び着手できるかも @didip1000 が 64 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug documentation in progress
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
CodeEditor - manually closing a tag causes crash対応中かも @olannyv が 29 日前に担当しました。 オープンbug in progress
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
bug in progress
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
-
bug in progress
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
laaielichter/AgentHaven#294 ·
メンテナーはふだん 1 日以内に返信
-
documentation P3 tests
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
cafebugado/backendeventos-public-api#128 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
opensearch-project/OpenSearch-Dashboards#13289 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
erkamyaman/rea-games#246 ·
メンテナーはふだん 1 日以内に返信