Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menubar: MenubarPassThroughOptions interface is missing submenu property #6536

Closed
Labels
Component: Unstyled Issue related to unstyled/passthrough attributes Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@klarbus
Copy link

klarbus commented May 1, 2024

Describe the bug

submenu property is missing in MenubarPassThroughOptions

submenu is defined in passthrough/tailwind/index.js for Tailwind.menubar.submenu , and classes are applied to the submenu as expected when running.

Reproducer

No response

PrimeReact version

10.6.3

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

The following code fails to compile in typescript

        <Menubar
          pt={{
            submenu: {
              className: "bg-blue-500",
            },
          }}
        />
lib/components/Banner.tsx:275:13 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(props: MenubarProps): Menubar', gave the following error.
    Object literal may only specify known properties, and 'submenu' does not exist in type 'MenubarPassThroughOptions'.
  Overload 2 of 2, '(props: MenubarProps, context: any): Menubar', gave the following error.
    Object literal may only specify known properties, and 'submenu' does not exist in type 'MenubarPassThroughOptions'.

275             submenu: {
                ~~~~~~~

  node_modules/primereact/menubar/menubar.d.ts:161:5
    161     pt?: MenubarPassThroughOptions;
            ~~
    The expected type comes from property 'pt' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Menubar> & Readonly<MenubarProps>'
  node_modules/primereact/menubar/menubar.d.ts:161:5
    161     pt?: MenubarPassThroughOptions;
            ~~
    The expected type comes from property 'pt' which is declared here on type 'IntrinsicAttributes & IntrinsicClassAttributes<Menubar> & Readonly<MenubarProps>'


Found 1 error in lib/components/Banner.tsx:275

Expected behavior

Typescript shouldn't complain about missing submenu property when it works as a passthrough option and is used by the default Tailwind theme.

@klarbus klarbus added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 1, 2024
@melloware melloware added Component: Unstyled Issue related to unstyled/passthrough attributes and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 1, 2024
@melloware melloware added this to the 10.7.0 milestone May 2, 2024
@melloware melloware added the Typescript Issue or pull request is *only* related to TypeScript definition label May 2, 2024
melloware added a commit that referenced this issue May 2, 2024
* Fix #6536: pt submenu fix

* Update menubar.d.ts

* Update menubar.d.ts

---------

Co-authored-by: Melloware <mellowaredev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Unstyled Issue related to unstyled/passthrough attributes Typescript Issue or pull request is *only* related to TypeScript definition
Projects
None yet
2 participants