Skip to content

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

Description

@codeworrior

Copied over from UI5/typescript#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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions