From bee35c38652505975db98cc3f19ca6b86f4a3927 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Wed, 17 Oct 2018 16:41:13 +0200 Subject: [PATCH] fix: better types --- src/core/client/ui/hocs/withKeyboardFocus.tsx | 6 ++++-- src/core/client/ui/hocs/withMouseHover.tsx | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core/client/ui/hocs/withKeyboardFocus.tsx b/src/core/client/ui/hocs/withKeyboardFocus.tsx index 70b79aded..179ff2302 100644 --- a/src/core/client/ui/hocs/withKeyboardFocus.tsx +++ b/src/core/client/ui/hocs/withKeyboardFocus.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { FocusEvent, MouseEvent } from "react"; -import { hoistStatics } from "recompose"; +import { DefaultingInferableComponentEnhancer, hoistStatics } from "recompose"; interface InjectedProps { onFocus: React.EventHandler>; @@ -14,7 +14,9 @@ interface InjectedProps { * to indicate a focus on the element, that wasn't triggered by mouse * or touch. */ -const withKeyboardFocus = hoistStatics( +const withKeyboardFocus: DefaultingInferableComponentEnhancer< + InjectedProps +> = hoistStatics( (BaseComponent: React.ComponentType) => { class WithKeyboardFocus extends React.Component { public state = { diff --git a/src/core/client/ui/hocs/withMouseHover.tsx b/src/core/client/ui/hocs/withMouseHover.tsx index a8f7efa59..a37fb015f 100644 --- a/src/core/client/ui/hocs/withMouseHover.tsx +++ b/src/core/client/ui/hocs/withMouseHover.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { MouseEvent, TouchEvent } from "react"; -import { hoistStatics } from "recompose"; +import { DefaultingInferableComponentEnhancer, hoistStatics } from "recompose"; interface InjectedProps { onMouseOver: React.EventHandler>; @@ -14,9 +14,11 @@ interface InjectedProps { * to indicate a focus on the element, that wasn't triggered by mouse * or touch. */ -const withMouseHover = hoistStatics( +const withMouseHover: DefaultingInferableComponentEnhancer< + InjectedProps +> = hoistStatics( (BaseComponent: React.ComponentType) => { - class WithMouseHover extends React.Component { + class WithMouseHover extends React.Component { public state = { mouseHover: false, lastTouchEndTime: 0,