Skip to content

Cannot use MenuBarItem class as type #6470

@danielvanmil

Description

@danielvanmil

Description

When we create a menu bar item in TypeScript like:

// Pseudo code
const component = window.document.createElement("vaadin-menu-bar-item");
component.value = { ... }

We cannot type the component like:

const component: MenuBarItem = window.document.createElement("vaadin-menu-bar-item");

Because the MenuBarItem is used for two types: the MenuBarItem interface that is exported from @vaadin/menu-bar and the MenuBarItem class which is not available?

How should this be done?

Expected outcome

Nicely typed API

Minimal reproducible example

See description

Steps to reproduce

See description

Environment

Vaadin version(s): 24.2
OS: all

Browsers

Issue is not browser related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions