Visitar URL original
[openui5] Type regression: Menu$ItemSelectedEventParameters.item changed from MenuItem to IMenuItem · Issue #73952 · DefinitelyTyped/DefinitelyTyped · GitHub
Skip to content

[openui5] Type regression: Menu$ItemSelectedEventParameters.item changed from MenuItem to IMenuItem #73952

Open

Description

@edemuck4timbuktu

🐞 Issue Description

Since version 1.138 (DefinitelyTyped PR #73225
), the sap.m interface Menu$ItemSelectedEventParameters defines the property item with the type IMenuItem.
Before this PR, the property had the type sap.m.MenuItem.

As a result, when accessing the "item" event parameter in a handler, previous method calls (e.g., getBindingContext) no longer work.

💥 Example

public onDateEndCalculateMenuButtonItemSelected(event: Menu$ItemSelectedEvent): void {
    const bindingContext = event.getParameter("item")?.getBindingContext("dialog");
}

TypeScript output:

error TS2339: Property 'getBindingContext' does not exist on type 'IMenuItem'.

📋 Details

This issue occurs everywhere the IMenuItem interface is used instead of sap.m.MenuItem.
The IMenuItem interface currently only contains one property:

__implements__sap_m_IMenuItem

💡 Expected Behavior

The item event parameter should provide access to the same methods as before (e.g., getBindingContext), or IMenuItem should properly reflect the type definition of sap.m.MenuItem.

✅ Environment

Type Definitions: since @types/openui5 version 1.138

UI5 Library: sap.m

TypeScript: 5.9.2

Activity

  1. akudev commented on Oct 23, 2025

    @akudev
    Contributor

    Caused by line 130 in Menu.js in UI5/openui5@68e35fe#diff-e60bd4cf5ac34d0fb8b76cc26188b0f7c4844767ee9990ae6dfd9f6e512750ddL130

    I think you created a discussion first because that's where this repository leads you when you want to report an issue with type definitions. We are "only" owners of those types do not have any privileges in this issue tracker, so we can't handle an issue reported here properly.
    We can move it to either https://github.com/UI5/typescript/issues when it is an issue in the dts-generator or https://github.com/UI5/openui5/issues when it is caused by a code change in OpenUI5 and the generator did its job correctly, but with wrong input.

    Right now it's not clear to me where to put this, though. On the one hand, it's clear how the TypeScript usage is affected by this change. The UI5 marker interfaces are not of use in a typed world, as they only declare a contract, but don't come with all the API covered by this. On the other hand, from a local perspective the OpenUI5 code change looks fine, but also the dts-generator behaves as expected. We'll have to look into whether we can enrich on TypeScript side what those marker interfaces mean and contain.

    Thanks for pointing uns to this issue, anyway!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions