Open rolanday opened 10 months ago
Could you share a codesandbox/stackblitz that is showing this error (or include the tsconfig)? I wasn't able to reproduce this here: https://stackblitz.com/edit/stackblitz-starters-brhygm
Hi Reid, thanks for taking a look. Here's a sandbox link that repros the TS error. (Note, functionally, the code works as expected). The linked project was created w/ vanilla remix config, + react-aria-components and framer-motion deps added. Please see <project-root>\app\components\button.tsx
, line 21. It's the exact same error I get on my devbox (currently @ts-ignore'ing it).
Thanks again!
Seems to stem from us allowing a function as children for render props. So you could change the types that your button accepts to remove that.
Omit<ButtonProps, "children"> & {children: React.ReactNode}
or you could check for a function and call it, or make use of composeRenderProps
if you wanted to keep it as an option.
H @snowystinger , thanks for the suggestions! No luck on fist -- fixes one type error and results in another (on <motion.button el). Same link edited to show: https://codesandbox.io/p/devbox/react-aria-framer-button-rhc83m?file=%2Fapp%2Fcomponents%2Fbutton.tsx
Probably could omit onAnimationStart
as well @devongovett I feel like I saw somewhere that you used our hooks with motion, is this what you did?
Provide a general summary of the issue here
The Hooks sample provided at the end of https://react-spectrum.adobe.com/react-aria/Button.html results in the following typescript error , when built as-is (i.e., using the code sample provided):
Issues seems to be related to https://github.com/framer/motion/issues/1723 , but not 100% sure and code-sample should build so filing separately.
๐ค Expected Behavior?
Code sample provided successuflly builds.
๐ฏ Current Behavior
๐ Possible Solution
No response
๐ฆ Context
No response
๐ฅ๏ธ Steps to Reproduce
Install react-aria-components 1.0.1 to TS configured project and attempt to build, then note error.
Version
react-aria-components 1.0.1
What browsers are you seeing the problem on?
Firefox, Chrome, Safari
If other, please specify.
No response
What operating system are you using?
macOS
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response