-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
1. Read the FAQs 👇
2. Describe the bug
#3368 updated the types of ReorderGroupComponent to return JSX.Element, but JSX is no longer a global namespace in the React 19 types. See https://react.dev/blog/2024/04/25/react-19-upgrade-guide#the-jsx-namespace-in-typescript
This results in a type error when Motion is imported in a project using React 19:
node_modules/framer-motion/dist/types/index.d.ts:515:226 - error TS2503: Cannot find namespace 'JSX'.
515 declare function ReorderGroupComponent<V, TagName extends ReorderElementTag = DefaultGroupElement>({ children, as, axis, onReorder, values, ...props }: ReorderGroupProps<V, TagName>, externalRef?: React$1.ForwardedRef<any>): JSX.Element;
You could use React.JSX.Element but more likely you want React.ReactNode which is the return type for React components in general.
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://github.com/billyjanitsch/motion-react-types-bug
4. Steps to reproduce
Run npm install && npm test in the minimal repo above.
5. Expected behavior
No type error.
6. Video or screenshots
n/a
7. Environment details
n/a
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working