@@ -166,7 +166,9 @@ let lastMouseEvent;
166
166
function updateMouseMovementPolyfillState ( event ) {
167
167
if ( event !== lastMouseEvent ) {
168
168
if ( lastMouseEvent && event . type === 'mousemove' ) {
169
+ // $FlowFixMe assuming this is a number
169
170
lastMovementX = event . screenX - lastMouseEvent . screenX ;
171
+ // $FlowFixMe assuming this is a number
170
172
lastMovementY = event . screenY - lastMouseEvent . screenY ;
171
173
} else {
172
174
lastMovementX = 0 ;
@@ -367,15 +369,20 @@ function getEventKey(nativeEvent) {
367
369
368
370
// FireFox implements `key` but returns `MozPrintableKey` for all
369
371
// printable characters (normalized to `Unidentified`), ignore it.
370
- const key = normalizeKey [ nativeEvent . key ] || nativeEvent . key ;
372
+ const key =
373
+ // $FlowFixMe unable to index with a `mixed` value
374
+ normalizeKey [ nativeEvent . key ] || nativeEvent . key ;
371
375
if ( key !== 'Unidentified' ) {
372
376
return key ;
373
377
}
374
378
}
375
379
376
380
// Browser does not implement `key`, polyfill as much of it as we can.
377
381
if ( nativeEvent . type === 'keypress' ) {
378
- const charCode = getEventCharCode ( nativeEvent ) ;
382
+ const charCode = getEventCharCode (
383
+ // $FlowFixMe unable to narrow to `KeyboardEvent`
384
+ nativeEvent ,
385
+ ) ;
379
386
380
387
// The enter-key is technically both printable and non-printable and can
381
388
// thus be captured by `keypress`, no other non-printable key should.
@@ -384,6 +391,7 @@ function getEventKey(nativeEvent) {
384
391
if ( nativeEvent . type === 'keydown' || nativeEvent . type === 'keyup' ) {
385
392
// While user keyboard layout determines the actual meaning of each
386
393
// `keyCode` value, almost all function keys have a universal value.
394
+ // $FlowFixMe unable to index with a `mixed` value
387
395
return translateToKey [ nativeEvent . keyCode ] || 'Unidentified' ;
388
396
}
389
397
return '' ;
@@ -441,7 +449,10 @@ const KeyboardEventInterface = {
441
449
// KeyPress is deprecated, but its replacement is not yet final and not
442
450
// implemented in any major browser. Only KeyPress has charCode.
443
451
if ( event . type === 'keypress' ) {
444
- return getEventCharCode ( event ) ;
452
+ return getEventCharCode (
453
+ // $FlowFixMe unable to narrow to `KeyboardEvent`
454
+ event ,
455
+ ) ;
445
456
}
446
457
return 0 ;
447
458
} ,
@@ -462,7 +473,10 @@ const KeyboardEventInterface = {
462
473
// `which` is an alias for either `keyCode` or `charCode` depending on the
463
474
// type of the event.
464
475
if ( event . type === 'keypress' ) {
465
- return getEventCharCode ( event ) ;
476
+ return getEventCharCode (
477
+ // $FlowFixMe unable to narrow to `KeyboardEvent`
478
+ event ,
479
+ ) ;
466
480
}
467
481
if ( event . type === 'keydown' || event . type === 'keyup' ) {
468
482
return event . keyCode ;
@@ -538,18 +552,21 @@ const WheelEventInterface = {
538
552
? event . deltaX
539
553
: // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
540
554
'wheelDeltaX' in event
541
- ? - event . wheelDeltaX
555
+ ? // $FlowFixMe assuming this is a number
556
+ - event . wheelDeltaX
542
557
: 0 ;
543
558
} ,
544
559
deltaY ( event ) {
545
560
return 'deltaY' in event
546
561
? event . deltaY
547
562
: // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
548
563
'wheelDeltaY' in event
549
- ? - event . wheelDeltaY
564
+ ? // $FlowFixMe assuming this is a number
565
+ - event . wheelDeltaY
550
566
: // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
551
567
'wheelDelta' in event
552
- ? - event . wheelDelta
568
+ ? // $FlowFixMe assuming this is a number
569
+ - event . wheelDelta
553
570
: 0 ;
554
571
} ,
555
572
deltaZ : 0 ,
0 commit comments