diff --git a/packages/fluentui/CHANGELOG.md b/packages/fluentui/CHANGELOG.md index cc90a074beae8..3886f12f1f2db 100644 --- a/packages/fluentui/CHANGELOG.md +++ b/packages/fluentui/CHANGELOG.md @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Fixes - `Popup` should not dismiss when its iframe content is focused @ling1726 ([#19955](https://github.com/microsoft/fluentui/pull/19955)) +- `whatInput` Add typings to what input event listeners @ling1726 ([#20024](https://github.com/microsoft/fluentui/pull/20024)) diff --git a/packages/fluentui/react-northstar/src/utils/whatInput.ts b/packages/fluentui/react-northstar/src/utils/whatInput.ts index 33e0cab974a18..452ecadfabd35 100644 --- a/packages/fluentui/react-northstar/src/utils/whatInput.ts +++ b/packages/fluentui/react-northstar/src/utils/whatInput.ts @@ -73,6 +73,8 @@ const setUp = () => { doUpdate(window.document); }; +type WhatInputEvents = MouseEvent | TouchEvent | KeyboardEvent; + /* * events */ @@ -107,7 +109,7 @@ const addListeners = (eventTarget: Window) => { }; // checks conditions before updating new input -const setInput = event => { +const setInput = (event: WhatInputEvents) => { // only execute if the event buffer timer isn't running if (!isBuffering) { const eventKey = event.which; @@ -133,7 +135,7 @@ const doUpdate = (target: Document) => { }; // buffers events that frequently also fire mouse events -const eventBuffer = event => { +const eventBuffer = (event: WhatInputEvents) => { // set the current input setInput(event);