mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 11:41:44 +00:00
Add tag to SortEvent
In order to check if the event target is a hyperlink and cancel sort if the user clicks a link, the recommended pattern is to check SortEvent.target.tagName. (see https://stackoverflow.com/questions/15661343/check-if-event-target-is-hyperlink). However, the typings do not support this pattern as SortEvent.target does not expect a tag attribute.
This commit is contained in:
Vendored
+9
-1
@@ -18,6 +18,14 @@ export interface SortStart {
|
||||
|
||||
export type SortEvent = React.MouseEvent<any> | React.TouchEvent<any>;
|
||||
|
||||
interface Tag extends React.EventTarget {
|
||||
tagName: string;
|
||||
}
|
||||
|
||||
export interface SortEventWithTag extends SortEvent {
|
||||
target: Tag;
|
||||
}
|
||||
|
||||
export type SortStartHandler = (sort: SortStart, event: SortEvent) => void;
|
||||
|
||||
export type SortMoveHandler = (event: SortEvent) => void;
|
||||
@@ -45,7 +53,7 @@ export interface SortableContainerProps {
|
||||
pressDelay?: number;
|
||||
pressThreshold?: number;
|
||||
distance?: number;
|
||||
shouldCancelStart?: (event: SortEvent) => boolean;
|
||||
shouldCancelStart?: (event: SortEvent | SortEventWithTag) => boolean;
|
||||
onSortStart?: SortStartHandler;
|
||||
onSortMove?: SortMoveHandler;
|
||||
onSortEnd?: SortEndHandler;
|
||||
|
||||
Reference in New Issue
Block a user