Skip to content

Comments

Fix incorrect type of Reorder.Item component#3363

Closed
m2na7 wants to merge 1 commit intomotiondivision:mainfrom
m2na7:fix/reorder-item-type-inference
Closed

Fix incorrect type of Reorder.Item component#3363
m2na7 wants to merge 1 commit intomotiondivision:mainfrom
m2na7:fix/reorder-item-type-inference

Conversation

@m2na7
Copy link

@m2na7 m2na7 commented Sep 10, 2025

Fixes #3359

Problem

There was an issue in the Reorder.Item component where using invalid props (e.g., onClick="error") did not trigger TypeScript errors, resulting in reduced type safety compared to motion.div.

Solution

I improved the Props interface by making it generic with a Tag parameter to support dynamic HTML element types.
Additionally, I enhanced type inference accuracy by using HTMLMotionProps<Tag> and DOMMotionComponents, and modified the forwardRef type to use specific HTML element types instead of any, thereby improving type safety by eliminating the use of any types.

@mattgperry mattgperry mentioned this pull request Sep 16, 2025
@mattgperry
Copy link
Collaborator

The tests were failing for this so replacing with #3368

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Incorrect type of Reorder.Item component

2 participants