react-spring icon indicating copy to clipboard operation
react-spring copied to clipboard

[bug]: Animated div typescript error regarding children prop

Open jeeheezy opened this issue 8 months ago • 7 comments

Which react-spring target are you using?

  • [x] @react-spring/web
  • [ ] @react-spring/three
  • [ ] @react-spring/native
  • [ ] @react-spring/konva
  • [ ] @react-spring/zdog

What version of react-spring are you using?

9.7.5

What's Wrong?

Animated tags don't seem to support children prop for TypeScript. This seems similar to issue #2332, but I'm not using Next 15/React 19, I am currently using Next 14.2.24 and React 18.3.1.

Image

The animated.div only has an SVG (made React component by SVGR) as a child. While I was able to get around the issue by using the animated function instead and passing a component in there (i.e. see second image, there are no typescript errors present there), I'm sure there would be situations where having animated.div take children would be preferable compared to defining a component separately.

Image

To Reproduce

Use an animated tag with children elements

Expected Behaviour

No Typescript issue

Link to repo

No public repo currently

jeeheezy avatar Feb 21 '25 23:02 jeeheezy