Event.dataTransfer.setDragImage in Angular2

I am implementing drag & drop functionality in Angular2 app. When I try to write this code

public onKitItemDragStart(itemID: number, index: number, event: DragEvent): void {
  let img: HTMLImageElement = document.createElement('img');
  img.src = '.....';
  // image styling here
  event.dataTransfer.setDragImage(img, 0, 0);
}

      

I am getting an error from TSLint:

TS2339: Property 'setDragImage' does not exist on type 'DataTransfer'.

In the meantime, if I do cmd + click on this method, I can see the method setDragImage

in DataTransfer

inferface in the lib.es6.d.ts file (I use storm if it matters).
So why am I getting this error?

One more question - ok, TSLint only checks dependencies, but this code doesn't work, why?

Alternatively, is it possible to simply remove the "translucency" from the ghost image? Since I am reading, I cannot, but maybe there is some way to do this?

+3


source to share





All Articles