Skip to content

fix(cdk/drag-drop): add generic parameter for item type in CdkDragDrop #23209

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

Merged
merged 1 commit into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cdk/drag-drop/drag-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export interface CdkDragExit<T = any, I = T> {


/** Event emitted when the user drops a draggable item inside a drop container. */
export interface CdkDragDrop<T, O = T> {
export interface CdkDragDrop<T, O = T, I = any> {
/** Index of the item when it was picked up. */
previousIndex: number;
/** Current index of the item. */
currentIndex: number;
/** Item that is being dropped. */
item: CdkDrag;
item: CdkDrag<I>;
/** Container in which the item was dropped. */
container: CdkDropList<T>;
/** Container from which the item was picked up. Can be the same as the `container`. */
Expand Down
4 changes: 2 additions & 2 deletions tools/public_api_guard/cdk/drag-drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class CdkDrag<T = any> implements AfterViewInit, OnChanges, OnDestroy {
}

// @public
export interface CdkDragDrop<T, O = T> {
export interface CdkDragDrop<T, O = T, I = any> {
container: CdkDropList<T>;
currentIndex: number;
distance: {
Expand All @@ -115,7 +115,7 @@ export interface CdkDragDrop<T, O = T> {
y: number;
};
isPointerOverContainer: boolean;
item: CdkDrag;
item: CdkDrag<I>;
previousContainer: CdkDropList<O>;
previousIndex: number;
}
Expand Down