Skip to content

fix(drag-drop): improved type safety for drag events #12740

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 20, 2018
Merged
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
17 changes: 8 additions & 9 deletions src/cdk-experimental/drag-drop/drag-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,34 @@ import {CdkDrag} from './drag';
import {CdkDropContainer} from './drop-container';

/** Event emitted when the user starts dragging a draggable. */
export interface CdkDragStart {
export interface CdkDragStart<T = any> {
/** Draggable that emitted the event. */
source: CdkDrag;
source: CdkDrag<T>;
}


/** Event emitted when the user stops dragging a draggable. */
export interface CdkDragEnd {
export interface CdkDragEnd<T = any> {
/** Draggable that emitted the event. */
source: CdkDrag;
source: CdkDrag<T>;
}

/** Event emitted when the user moves an item into a new drop container. */
export interface CdkDragEnter<T> {
export interface CdkDragEnter<T = any, I = T> {
/** Container into which the user has moved the item. */
container: CdkDropContainer<T>;
/** Item that was removed from the container. */
item: CdkDrag;
item: CdkDrag<I>;
}

/**
* Event emitted when the user removes an item from a
* drop container by moving it into another one.
*/
export interface CdkDragExit<T> {
export interface CdkDragExit<T = any, I = T> {
/** Container from which the user has a removed an item. */
container: CdkDropContainer<T>;
/** Item that was removed from the container. */
item: CdkDrag;
item: CdkDrag<I>;
}


Expand Down