Skip to content

Commit

Permalink
🚨 Add type annotations to useListener.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
pajowu committed Nov 1, 2021
1 parent 20a7de4 commit 81a4852
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/util/useListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function useWindowEvent<K extends keyof WindowEventMap>(
type: K,
listener: (this: Window, ev: WindowEventMap[K]) => any,
deps: DependencyList = []
) {
): void {
useEffect(() => {
window.addEventListener(type, listener);
return () => window.removeEventListener(type, listener);
Expand All @@ -15,7 +15,7 @@ export function useDocumentEvent<K extends keyof DocumentEventMap>(
type: K,
listener: (this: Document, ev: DocumentEventMap[K]) => any,
deps: DependencyList = []
) {
): void {
useEffect(() => {
document.addEventListener(type, listener);
return () => document.removeEventListener(type, listener);
Expand Down

0 comments on commit 81a4852

Please sign in to comment.