From 07c6d513388c4538140e0ff37dc9035c9dc6fea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 16 Apr 2021 23:33:30 +0200 Subject: [PATCH] fix: fix type for clientRect --- packages/suggestion/src/suggestion.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/suggestion/src/suggestion.ts b/packages/suggestion/src/suggestion.ts index 1531a0e0..a3f071a5 100644 --- a/packages/suggestion/src/suggestion.ts +++ b/packages/suggestion/src/suggestion.ts @@ -36,7 +36,7 @@ export interface SuggestionProps { items: any[], command: (props: any) => void, decorationNode: Element | null, - clientRect: () => (DOMRect | null), + clientRect: (() => DOMRect) | null, } export interface SuggestionKeyDownProps { @@ -103,7 +103,9 @@ export function Suggestion({ decorationNode, // virtual node for popper.js or tippy.js // this can be used for building popups without a DOM node - clientRect: () => decorationNode?.getBoundingClientRect() || null, + clientRect: decorationNode + ? () => decorationNode.getBoundingClientRect() + : null, } if (handleExit) {