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

OverridableComponent usage with ModalTypeMap causes some issues #283

Open
3 of 15 tasks
brionmario opened this issue Oct 10, 2024 · 0 comments
Open
3 of 15 tasks

OverridableComponent usage with ModalTypeMap causes some issues #283

brionmario opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working package:react Issues/PRs related to the `@oxygen-ui/react` package.

Comments

@brionmario
Copy link
Member

brionmario commented Oct 10, 2024

Describe the issue:

OverridableComponent usage with ModalTypeMap causes the following issue.

Menu component with the OverridableComponent usage:

const Menu: OverridableComponent<ModalTypeMap<ModalTypeMap['defaultComponent'], MenuProps>> & WithWrapperProps =
  forwardRef(
    <C extends ElementType = ElementType>(
      {className, ...rest}: MenuProps<C>,
      ref: Ref<HTMLDivElement>,
    ): ReactElement => {
      const classes: string = clsx('oxygen-menu', className);

      return <MuiMenu ref={ref} className={classes} {...rest} />;
    },
  ) as OverridableComponent<ModalTypeMap<ModalTypeMap['defaultComponent'], MenuProps>> & WithWrapperProps;

❌ Error:

Screenshot 2024-10-11 at 01 37 13

How to reproduce:

  • Use the OverridableComponent with ModalTypeMap

Expected behavior:

Typescript shouldn't complain

Additional context :

  • Affected Package:
    • @oxygen-ui/logger
    • @oxygen-ui/primitives
    • @oxygen-ui/react
    • @oxygen-ui/react-icons
  • Library Version: [e.g., 1.10.0, 2.0.0-alpha]
  • OS:
    • Windows
    • Linux
    • Mac
    • Other
  • Browser:
    • Google Chrome
    • Firefox
    • Safari
    • Microsoft Edge
    • Brave
    • Opera
    • Other

Optional Fields

Related issues:

@brionmario brionmario added the bug Something isn't working label Oct 10, 2024
@brionmario brionmario self-assigned this Oct 10, 2024
@brionmario brionmario added the package:react Issues/PRs related to the `@oxygen-ui/react` package. label Oct 10, 2024
@brionmario brionmario removed their assignment Oct 10, 2024
brionmario added a commit to brionmario/oxygen-ui that referenced this issue Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:react Issues/PRs related to the `@oxygen-ui/react` package.
Projects
None yet
Development

No branches or pull requests

1 participant