-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compose: Add types to useDragging
#32285
Conversation
Size Change: -3 B (0%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@@ -8,6 +8,12 @@ import { useCallback, useEffect, useRef, useState } from '@wordpress/element'; | |||
*/ | |||
import useIsomorphicLayoutEffect from '../use-isomorphic-layout-effect'; | |||
|
|||
/** | |||
* @param {Object} props | |||
* @param {(e: MouseEvent) => void} props.onDragStart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming we intentionally use MouseEvent
instead of DragEvent
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, onDragStart
gets passed to onmousedown
instead of ondrag
actually.
Description
Adds types to
useDragging
. There are no real runtime changes except to explicitly pass through the event parameter instead of using...args
. Using varargs was not necessary in this case (there's only ever one parameter, the event).Part of #18838
How has this been tested?
Type checks pass.
Types of changes
New feature.
Checklist:
*.native.js
files for terms that need renaming or removal).