Skip to content

Commit c03d8ac

Browse files
authored
fix(cdk/drag-drop): add generic parameter for item type in CdkDragDrop (#23209)
Fixes that the `CdkDragDrop` event didn't have a way of typing the item. Fixes #23208.
1 parent a4ae3b8 commit c03d8ac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cdk/drag-drop/drag-events.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ export interface CdkDragExit<T = any, I = T> {
5454

5555

5656
/** Event emitted when the user drops a draggable item inside a drop container. */
57-
export interface CdkDragDrop<T, O = T> {
57+
export interface CdkDragDrop<T, O = T, I = any> {
5858
/** Index of the item when it was picked up. */
5959
previousIndex: number;
6060
/** Current index of the item. */
6161
currentIndex: number;
6262
/** Item that is being dropped. */
63-
item: CdkDrag;
63+
item: CdkDrag<I>;
6464
/** Container in which the item was dropped. */
6565
container: CdkDropList<T>;
6666
/** Container from which the item was picked up. Can be the same as the `container`. */

tools/public_api_guard/cdk/drag-drop.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
103103
}
104104

105105
// @public
106-
export interface CdkDragDrop<T, O = T> {
106+
export interface CdkDragDrop<T, O = T, I = any> {
107107
container: CdkDropList<T>;
108108
currentIndex: number;
109109
distance: {
@@ -115,7 +115,7 @@ export interface CdkDragDrop<T, O = T> {
115115
y: number;
116116
};
117117
isPointerOverContainer: boolean;
118-
item: CdkDrag;
118+
item: CdkDrag<I>;
119119
previousContainer: CdkDropList<O>;
120120
previousIndex: number;
121121
}

0 commit comments

Comments
 (0)