Skip to content

Commit

Permalink
fix: fix type for clientRect
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Apr 16, 2021
1 parent 61c9e79 commit 07c6d51
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/suggestion/src/suggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 07c6d51

Please sign in to comment.