UI5 / UI5/openui5

sap.m.Menu itemSelected event parameter item is typed too broadly

Open Beginner friendly
#4,475 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Copied over from https://github.com/UI5/typescript/issues/629, originally created by @edemuck:

What is the issue and how can we reproduce it?

In the generated typings for sap.m.Menu, the event parameter item of Menu$ItemSelectedEventParameters is typed as IMenuItem.

However, for the itemSelected event, the selected item should be a concrete sap.m.MenuItem.

Current typing

In sap.m.d.ts, the type is defined as:

export interface Menu$ItemSelectedEventParameters {
  item?: IMenuItem;
}
Expected typing

The item property should be typed as:

item?: MenuItem;

or equivalently sap.m.MenuItem, if that is the preferred style in the generated declarations.

Why this matters

IMenuItem is too generic for consumers of the itemSelected event and makes the event payload less precise than the runtime contract. This can lead to unnecessary type checks or missing access to MenuItem-specific APIs in application code.

Suggested fix

Update the generated typings for Menu$ItemSelectedEventParameters so that item uses MenuItem instead of IMenuItem.

Which OpenUI5 version is your project targeting?

master

Is the issue device- or browser-specific?

No.

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.

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.

Research direction

Start in sap.m.d.ts at Menu$ItemSelectedEventParameters and inspect the generated declaration for the itemSelected event. Verify that the event exposes the concrete MenuItem type rather than IMenuItem, then run the repository's relevant type-generation or validation checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.