From 5f7bca54893c1fbe9913f567d6b573766999006b Mon Sep 17 00:00:00 2001 From: Federico Zivolo Date: Sat, 11 Apr 2020 15:43:39 +0200 Subject: [PATCH] fix: update and forceUpdate TS types --- typings/react-popper.d.ts | 4 ++-- typings/tests/main-test.tsx | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/typings/react-popper.d.ts b/typings/react-popper.d.ts index aff06b6..dc7b1c4 100644 --- a/typings/react-popper.d.ts +++ b/typings/react-popper.d.ts @@ -58,6 +58,6 @@ export function usePopper( styles: { [key: string]: React.CSSProperties }; attributes: { [key: string]: { [key: string]: string } }; state: PopperJS.State; - update: Pick; - forceUpdate: Pick; + update: PopperJS.Instance['update'] | null; + forceUpdate: PopperJS.Instance['forceUpdate'] | null; }; diff --git a/typings/tests/main-test.tsx b/typings/tests/main-test.tsx index a313e6a..8af4ba6 100644 --- a/typings/tests/main-test.tsx +++ b/typings/tests/main-test.tsx @@ -56,13 +56,23 @@ const HookTest = () => { const [arrowElement, setArrowElement] = React.useState( null ); - const { styles, attributes } = usePopper(referenceElement, popperElement, { - modifiers: [{ name: 'arrow', options: { element: arrowElement } }], - }); + const { styles, attributes, update } = usePopper( + referenceElement, + popperElement, + { + modifiers: [{ name: 'arrow', options: { element: arrowElement } }], + } + ); return ( <> -