`@react-aria/button` wrong typescript bindings
🐛 Bug Report
useButton(...) hook from @react-aria/button package is returning a wrong type.
🤔 Expected Behavior
I would expect the returned TypeScript types are correct and working.
😯 Current Behavior
Consider following simple example where typescript throws an error:
...
const { buttonProps } = useButton(props, ref);
^^^^^^^^^^^
Unsafe array destructuring of a tuple element with an 'any' value.eslint@typescript-eslint/no-unsafe-assignment
...
💁 Possible Solution
For some reason in the installed generated TypeScript bindings located in node_modules/@react-aria/button/dist/types.d.ts, the ButtonHTMLAttributes type is not imported. After I've tried to properly import import { ButtonHTMLAttributes } from react in the types.d.ts it started to work. I've tried to build the whole react-spectrum locally and the bindings are generated correctly so maybe the publised dist folder contains outdated version?
🌍 Your Environment
| Software | Version(s) |
|---|---|
| react-spectrum | 3.3.4 |
| Browser | X |
| Operating System | MacOS |
I think this might be a duplicate that'll be fixed when we next release react-aria https://github.com/adobe/react-spectrum/issues/1388 the fix is already merged, we just haven't re-released the package yet, but will in our next release you might be able to check with the nightly version
@mitas1 Let us know if you are getting this still with 3.4.0 of @react-aria/button, I'm seeing the proper types being imported within the dist/types.d.ts now
Hey @snowystinger and @LFDanLu i have recently started a project with version ^3.20.0 and can confirm this has been fixed if you want to close this issue.
Thanks for checking on that!