function removeFromArray < T > ( array , item ) { const index = array . indexOf ( item ) ; if ( index >= 0 ) { array . splice ( index , 1 ) ; } } export class FakeDataTransferItem implements DataTransferItem { private file : File ; kind : string ; type : string ; constructor ( file , kind ) { this . file = file ; this . kind = kind ; } getAsFile ( ) { return this . file ; } getAsString ( callback ) { throw new Error ( 'Method not implemented.' ) ; } webkitGetAsEntry ( ) { return this . file ; } } export class FakeDataTransfer implements DataTransfer { dataByFormat = { } ; dropEffect : 'none' | 'copy' | 'link' | 'move' = 'none' ; effectAllowed : 'none' | 'copy' | 'copyLink' | 'copyMove' | 'link' | 'linkMove' | 'move' | 'all' | 'uninitialized' = 'all' ; files : FileList ; types : string [ ] = [ ] ; items : DataTransferItemList ; constructor ( files ? , items ? ) { this . files = files as any ; this . items = items as any ; } clearData ( dataFormat ) { if ( dataFormat ) { delete this . dataByFormat [ dataFormat ] ; removeFromArray ( this . types , dataFormat ) ; } else { this . dataByFormat = { } ; this . types = [ ] ; } } getData = function ( dataFormat ) { return this . dataByFormat [ dataFormat ] ; } ; setData ( dataFormat , data ) { this . dataByFormat [ dataFormat ] = data ; if ( this . types . indexOf ( dataFormat ) < 0 ) { this . types . push ( dataFormat ) ; } return true ; } setDragImage = function ( ) { } ; }