material-ui
material-ui copied to clipboard
[base][Button] Button's mouse event is of type any in 5.12.3
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:
- 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

Your environment 🌎
n/a see codesandbox
@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
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.
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, the case we've talked about is actually slightly different. I fixed the issue reported here.