Skip to content

[Bug] @rocket.chat/ui-client build fails — GenericMenu typed against wrong Menu API (V1 vs V2) causing TS2590/TS2339 errors #39366

@kushkumarkashyap7280

Description

@kushkumarkashyap7280

GenericMenu — Bug Report


The Issue

What Was the Problem?

The @rocket.chat/ui-client package failed to build on the develop branch with 5 TypeScript errors in GenericMenu.tsx.

Root Cause:
GenericMenu was typed against ComponentProps<typeof Menu>, where Menu is the top-level export from @rocket.chat/fuselage. After a fuselage upgrade, the top-level Menu became the options-based (V1) API, which has no onAction or button props. However, the component implementation uses the compound/V2 API (onAction, button, MenuItem, MenuSection), which only exists on MenuV2.

This mismatch caused TypeScript to:

  • Produce an unresolvable union type (too complex to represent).
  • Reject onAction and button as non-existent props.

screenshot
Image

Errors Reported

src/components/GenericMenu/GenericMenu.tsx:33:24
  error TS2590: Expression produces a union type that is too complex to represent.

src/components/GenericMenu/GenericMenu.tsx:33:56
  error TS2339: Property 'onAction' does not exist on type 'GenericMenuProps'.

src/components/GenericMenu/GenericMenu.tsx:33:82
  error TS2339: Property 'button' does not exist on type 'GenericMenuProps'.

src/components/GenericMenu/GenericMenu.tsx:66:6
  error TS2322: Property 'onAction' does not exist on type '...'. Did you mean 'action'?

src/components/GenericMenu/GenericMenu.tsx:91:6
  error TS2322: Property 'onAction' does not exist on type '...'. Did you mean 'action'?

Affected File

packages/ui-client/src/components/GenericMenu/GenericMenu.tsx

### Detailed

`@rocket.chat/ui-client` fails to build due to TypeScript errors in `GenericMenu.tsx`.
`GenericMenu` is typed against the top-level `Menu` export from `@rocket.chat/fuselage`,
which is now the V1 options-based API and no longer exposes `onAction` or `button`.
The component implementation requires the V2 API (MenuV2).

### Steps to reproduce:

1. Checkout the `develop` branch.
2. Run `yarn build` from the repository root
   (or `yarn workspace @rocket.chat/ui-client build`).
3. Observe TypeScript compilation failure in `GenericMenu.tsx`.

### Expected behavior:

The package compiles successfully with no TypeScript errors.

### Actual behavior:

Build exits with code 2. Five TypeScript errors are thrown:
- TS2590: Expression produces a union type that is too complex to represent.
- TS2339: Property 'onAction' does not exist on type 'GenericMenuProps'.
- TS2339: Property 'button' does not exist on type 'GenericMenuProps'.
- TS2322 (x2): Property 'onAction' does not exist on ... Did you mean 'action'?

### Server Setup Information:
- Version of Rocket.Chat Server: develop
- Operating System: Linux

### Relevant logs:
ERROR: command (/workspaces/Rocket.Chat/packages/ui-client) yarn run build exited (2)
Failed: @rocket.chat/ui-client#build

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