material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[base][Button] Button's mouse event is of type any in 5.12.3

Open gkiely opened this issue 1 year ago • 3 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/divine-framework-565ppe?file=/src/App.tsx

Steps:

  1. Go to codesandbox, observe App.tsx

Current behavior 😯

shows type of any

Expected behavior 🤔

shows type of React.MouseEvent

Context 🔦

5.12.1 shows the correct type

image

Your environment 🌎

n/a see codesandbox

gkiely avatar May 04 '23 02:05 gkiely

@gkiely

If you import Button from @mui/base/Button, you will get type any If you want type instead of any, replace your import from import Button from "@mui/base/Button"; to import Button from "@mui/material/Button";

I don't know for @mui/base/Button type any is intentionally or not

PunitSoniME avatar May 04 '23 05:05 PunitSoniME

If you import Button from @mui/base/Button, you will get type any If you want type instead of any, replace your import from import Button from "@mui/base/Button"; to import Button from "@mui/material/Button";

I don't know for @mui/base/Button type any is intentionally or not

@PunitSoniME the issue is specifically for the Button in @mui/base.

mnajdova avatar May 04 '23 12:05 mnajdova

It's a regression from https://github.com/mui/material-ui/pull/36677, we discussed this with @michaldudak. I agree that this is unexpected, although we have some explanation for it. It's the most common use-case for a button. Btw, you can use this code while we resolve it:

<Button
  onClick={(e: React.MouseEvent<HTMLButtonElement>) => {...}}
/>

mnajdova avatar May 04 '23 12:05 mnajdova

@mnajdova, the case we've talked about is actually slightly different. I fixed the issue reported here.

michaldudak avatar May 04 '23 20:05 michaldudak