Skip to content

Commit

Permalink
Make target option support undefined (#1353)
Browse files Browse the repository at this point in the history
It should be possible to use the ref without having to declare it as null
  • Loading branch information
dan-klasson authored Sep 1, 2022
1 parent 51e8f04 commit 886a672
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/forty-seals-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"rooks": patch
---

Make useKey target option support undefined
2 changes: 1 addition & 1 deletion packages/rooks/src/hooks/useKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Options = {
* target ref on which the events should be listened. If no target is specified,
* events are listened to on the document
*/
target?: MutableRefObject<Document> | MutableRefObject<HTMLElement | null>;
target?: MutableRefObject<Document> | MutableRefObject<HTMLElement | null | undefined>;
/**
* when boolean to enable and disable events, when passed false
* remove the eventlistener if any
Expand Down

1 comment on commit 886a672

@vercel
Copy link

@vercel vercel bot commented on 886a672 Sep 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.